我想設置AlertDialogue
主題或更改背景顏色。警報對話框背景主題/顏色
雖然我知道它有一個默認的主題,但在不同的版本我得到不同的主題,所以我想修復它的所有版本。
或者簡單地改變背景顏色爲白色
@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));
注:上述行會做,但我想知道我應該給樣式我AlertDialogue
你還在尋找解決方案嗎? –
是的,我還沒有找到一個! – SamH67
參考這一個http://stackoverflow.com/questions/2422562/how-to-change-theme-for-alertdialog –