我正在使用样式来设置我的警告对话框,大多数内容都已经被设置成了你下面可以看到的样子,但是多选项并没有改变颜色。我还希望复选框是白色的,但是不确定该怎么做。
警告对话框:
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this, R.style.AlertDialogDarkBlue);
builder.setTitle("Faulty Part");
final ArrayList<Integer> selectedFaults = new ArrayList<>();
builder.setMultiChoiceItems(faultsList, null, new DialogInterface.OnMultiChoiceClickListener(){
@Override
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
if (isChecked) {
// If the user checked the item, add it to the selected items
selectedFaults.add(indexSelected);
} else if (selectedFaults.contains(indexSelected)) {
// Else, if the item is already in the array, remove it
selectedFaults.remove(Integer.valueOf(indexSelected));
}
}
});
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
onResume();
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
AlertDialogBlue 样式:
<style name="AlertDialogDarkBlue" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColor">@color/colorWhite</item>
<item name="textColorAlertDialogListItem">@color/colorWhite</item>
<item name="android:background">@color/colorDarkBlue</item>
</style>
当前的样子:
AppCompat.Dark
而不是AppCompat.Light
。 - Pier Giorgio Misley