Only down-to-earth people can say: road, at my feet.
This content: Dialog dialog box
Example three: information content is a simple view type
Here is the Mainactivity.java main interface file:
public class Mainactivity extends activity{private Button b; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); b= (Button) Findviewbyid (R.id.button) ; B.setonclicklistener (New View.onclicklistener () {@Overridepublic void OnClick (View arg0) {Dialog ();}});} private void Dialog () {new Alertdialog.builder (this). Settitle ("Please enter"). SetIcon ( android. R.drawable.ic_dialog_info). Setview ( new EditText (This)). Setpositivebutton ("OK", null) . Setnegativebutton ("Cancel", null). Show ();}}
here is the result of the operation:
message content is a set of radio boxes
Below is the Mainactivity.java main interface file:
public class Mainactivity extends activity{private Button b; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); b= (Button) Findviewbyid (R.id.button) ; B.setonclicklistener (New View.onclicklistener () {@Overridepublic void OnClick (View arg0) {Dialog ();}});} private void Dialog () {new Alertdialog.builder (this). Settitle ("Radio Box"). SetIcon ( android. R.drawable.ic_dialog_info). Setsinglechoiceitems ( new string[] {"Male", "female"}, 0,//0 Default check male, 1 default female new Dialoginterface.onclicklistener () {public void OnClick (dialoginterface dialog, int which) { Dialog.dismiss () ; } }). Setnegativebutton ("Cancel", null). Show ();}}
here is the result of the operation:
message content is a set of multi-box
Below is the Mainactivity.java main interface file:
public class Mainactivity extends activity{private Button b; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); b= (Button) Findviewbyid (R.id.button) ; B.setonclicklistener (New View.onclicklistener () {@Overridepublic void OnClick (View arg0) {Dialog ();}});} private void Dialog () {new Alertdialog.builder (this). Settitle ("check box"). Setmultichoiceitems ( new string[] {"Item1", "ITEM2"}, NULL, NULL). Setpositivebutton ("OK", null). Setnegativebutton ("Cancel", null). Show ();}}
here is the result of the operation:
This is about here, take your time and enjoy it
45th: Android Dialog dialog box (ii)