Android 8

Android ui dialog box
・ The dialog box generated by Alertdialog is divided into two areas, 1: icon area, title area, content area and button area.
The steps to create the dialog box
use Alertdialog, Bui lder to create objects
and call. Alertdialog. Builder's settitleo or The setcustomtitle0 method sets the title.
· Call Alertdialog. Builder's seticono way to set the icon
you determine in addition to data?
• Call Alert Dialog, settings method Builder Setup dialog box contents
· call Alertdialog. Builder's setpositivebutton, setnegativebuttono or setneutralbutton O method to add
add more buttons
to call Alertdialog create Alertdialog objects create0 method Builder, and then call the show Alertdialog) object () square
method displays the dialog box

Custom dialog

Create a custom style file
//Get the layout file View view=getLayoutlnflaterO.inflate(R.layout.test,null);
//Set the custom style layout file; directly use the layout file id to set the view builder.setView(view) ; //Get custom component id
Button btn=view.findViewByld(R.id.login):btn.setText("Test login");

Guess you like

Origin blog.51cto.com/14589602/2641114