2018年4月5日 星期四

Add a customized theme to AlertDialog

Reference:

http://blog.supenta.com/2014/07/02/how-to-style-alertdialogs-like-a-pro/

Code snippet:

Context mThemeContext = new ContextThemeWrapper(this, R.style.customized_theme);
View dialogView = View.inflate(mThemeContext, R.layout.my_dialog, null);
AlertDialog.Builder aBuilder = new AlertDialog.Builder(mThemeContext);
aBuilder.setView(dialogView);

// setup your AlertDialog
......

AlertDialog aDialog = aBuilder.create();
aDialog.show();

沒有留言: