我想设置AlertDialogue
主题或change背景颜色。
虽然我知道它有一个默认主题,但在不同的版本中我得到了不同的主题,所以我想为所有版本修复它。
或者简单地将背景颜色更改为白色
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
final SimpleAdapter adapter = new SimpleAdapter(getContext(), imagesWithNames, R.layout.lib_dialog_image,
new String[]{"name", "imageID","Spacing"}, new int[]{R.id.text1, R.id.image1,R.id.spacing});
return new AlertDialog.Builder(getContext()).setAdapter(adapter,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
((PlaceCallActivity) getContext()).OnSelected(WithNamesFragment.this.getClass(), (int) ((HashMap<String, Object>) adapter.getItem(i)).get("imageID"));
}
}).setCancelable(true).setTitle("PICK YOUR AVATAR").setNegativeButton("Cancel",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).create();
}
不要发布您的代码,请告诉我应该在此处进行更改。
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom));
Note :上面的行可以做到这一点,但我想知道我应该在哪里为我的风格提供风格AlertDialogue