With Alertdialog.builder, you can also customize your own dialog. But if there is edittext in dialog, you will find that clicking on the EditText system may not eject the soft keyboard. This problem does not occur when you use the inherited dialog method. Custom Dialog Sample code:
public class mydialog extends dialog{ private context The Context; //oncreate () function is not called until the show () method is called. @Override protected void oncreate (bundle Savedinstancestate) { // todo auto-generated method stub super.oncreate (savedInstanceState); this.setcontentview (r.layout.mydialog_layout); //set the width of the dilaog to screen width-40, highly adaptive, dialog automatically centered. this.getwindow (). setlayout (Context.getresources (). Getdisplaymetrics (). widthpixels-40, layoutparams.wrap_content); } public mydialog (Context context) { &nbsP; super (context); // todo auto-generated constructor stub this.context=context; //Remove title bar This.requestwindowfeature (Window.feature_no_title); }
This article is from the "focus_000" blog, make sure to keep this source http://120806872.blog.51cto.com/8289253/1606205
Android Custom Dialog