我使用的是AlertDialog的setMultiChoiceItems。复选标记位于选项文本的垂直中心。我希望它在最上面。如何做到这一点? (Kotlin代码。Java answers就可以了。) AlertDialog.Builder (this).run {
val choices = arrayOf(
"Option 1 is very long. It is more than 3 lines. I would like to align the text top with the check box
我正在使用AlertDialog.Builder.setMultiChoiceItems显示带有文本的复选框。我可以成功地显示选中的项目,但每当我向下或向上滚动时,其中一些项目会随机变为未选中状态。下面是我的代码。
我能做些什么来解决这个问题呢?感谢任何人的帮助!
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Title")
.setMultiChoiceItems(items, selectedItems,
new D
我正在使用AlertDialog.Builder和setMultiChoiceItems创建一个多项选择AlertDialog。
我想从OnMultiChoiceClickListener中选中/取消选中项目,但我找不到方法。
下面是我的代码:
final List<User> users = Util.getUsers();
final String[] names = new String[users.size()];
final boolean[] checked = new boolean[users.size()];
for (int i=0; i < names.
我遵循并定制了一些关于DialogFragments的Android教程,下面是我编写的代码:
public class ChooseDialog extends DialogFragment {
ArrayList mSelectedItems;
CharSequence[] items;
boolean[] selected;
public static ChooseDialog newInstance(CharSequence[] options) {
ChooseDialog f = new ChooseDialog();
Bundle args = new B
adLang.setMultiChoiceItems(R.array.Lang, checkedItems, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i, boolean isChecked) {
if (isChecked) {
adMutiple.add(i);
String
我有一个名为customObjectList的自定义对象列表。我希望它绑定到AlertDialog.Builder.setMultiChoiceItems(),这需要首先将它转换为CharSequence,
我就是这样做的:customObjectList.toArray(new CharSequence[customObjectList.size()]),但是我得到了这个错误:
java.lang.ArrayStoreException: source[0] of type com.idea.customobject cannot be stored in destination array
我有以下代码来显示可点击项目的列表(用户可以选择多个项目)
return new AlertDialog.Builder(this)
.setTitle("Users")
.setMultiChoiceItems(csUser, _selections,
new DialogSelectionClickHandler())
.setPositiveButton("OK", new DialogButtonClickHandler())
.crea
我试图在数组中获取所选项的值。这是我的密码:
final String items[] = {"Blue","Green","Orange"};
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Money Maker");
alert.setIcon(R.drawable.ic_launcher);
alert.setMultiChoiceItems(items, c
我想清除选中的项目时,总共有三个项目被选中,我正在做以下操作,但不是工作…
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getText(R.string.escolhaArquivosBaixados));
builder.setMultiChoiceItems(items, selected, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public voi
我试图使一个AlertDialog出现,让我们从一个列表中选择几个项目。这应该是非常简单的,我遵循了这个指南:,但我的项目没有出现!我只是得到一个对话信息和按钮,没有歌词.
这是我的密码:
public class PlayerPickerDialogFragment extends DialogFragment {
//OK - so I tried making a CharSequence array, just to be sure where the error was...
final CharSequence[] names = {"cgu", "carl
我有一个AlertDialog of 多选择 item,我想在每个项目旁边有一个EditText。我怎样才能做到这一点?
third_card.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog.Builder mBuilder = new AlertDialog.Builder(EnterRecordActivity.this);
我想要创建具有多个选择项的对话框,比如在上
唯一的问题是,我正在使用PHP从MySQL数据库中获取MySQL,所以我无法提供资源id,就像请求的那样。任何帮助都是感激的,
谢谢!
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("")
.setMultiChoiceItems(db.getProjetky(), null, //the first argument needs to be resource id (int)