AlertDialog 5 styles corresponding to the default Theme

 

Dialog alertDialog = new AlertDialog.Builder(this,AlertDialog.THEME_TRADITIONAL)
				.setTitle(R.string.msg_dialog_title)
				.setPositiveButton("OK", null)
				.setNegativeButton("Cancel", null)
				.setItems(list.toArray(new String[list.size()]),
						new DialogInterface.OnClickListener() {
							@Override
							public void onClick(DialogInterface dialog,
									int which) {
								et.setText(list.get(which));
								et.setSelection(et.getText().length());
							}
						}).create();
		alertDialog.show();

 

The second parameter in Builder(this, AlertDialog.THEME_TRADITIONAL) can set different Theme

 

AlertDialog.THEME_HOLO_DARK

AlertDialog.THEME_HOLO_LIGHT

The above two are shown in the picture below, respectively dark/light

 

 

 

AlertDialog.THEME_DEVICE_DEFAULT_DARK

AlertDialog.THEME_DEVICE_DEFAULT_LIGHT

The above two are shown in the picture below, respectively dark/light

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326763309&siteId=291194637
Recommended