我要创建一个警告对话框,其中有多个复选框,行是从右到左。我的意思是复选框位于每行的右侧,我可以更改文本颜色和其他内容...... 那我该怎么办呢? 这是我的代码。但所有方向都是从左到右。
Dialog dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.choose_your_category));
builder.setCancelable(false);
builder.setMultiChoiceItems(items, null,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedItemId, boolean isSelected) {
if (isSelected) {
posarray.add(selectedItemId);
} else if (posarray.contains(selectedItemId)) {
posarray.remove(Integer.valueOf(selectedItemId));
}
}
})
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//Your logic when OK button is clicked.
for (int i = 0; i < posarray.size(); i++) {
int position = posarray.get(i);
idarray.add(catarrayList.get(position).getCategoryId());
}
}
})
.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
dialog = builder.create();
dialog.show();