To create a custom dialog box:
//Dialog BuilderBuilder Builder =NewAlertdialog.builder ( This);//Create an empty dialog boxFinal Alertdialog Dialog =builder.create ();//loading a custom view layoutView view = View.inflate ( This, R.layout.custom_dialog,NULL);intViewspacingleft =0;intViewspacingtop =0;intViewspacingright =0;intViewspacingbottom =0;//Specify a custom layout file for the dialog box, and the upper and lower left border is 0: otherwise the dialog box will appear black box, because the lower version of the dialog box, do not specify the background is black. Dialog.setview (view, Viewspacingleft, Viewspacingtop, Viewspacingright, viewspacingbottom);//Find button, set click eventButton Btn_login =(Button) View.findviewbyid (R.id.btn_login); Button Btn_cancel=(Button) View.findviewbyid (r.id.btn_cancel); Btn_login.setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (View v) {toast.maketext (Getapplicationcontext (),"Make sure the button is clicked", Toast.length_short). Show (); Dialog.dismiss (); }}); Btn_cancel.setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (View v) {toast.maketext (Getapplicationcontext (),"the Cancel button is clicked", Toast.length_short). Show (); Dialog.dismiss (); }});//Show dialog BoxDialog.show ();
Android Frame Animation