Learned about Android's most popular controls today
TextView
<textview android:id= "@+id/text_view" android:layout_width= "Match_parent" android:layout_height= "W Rap_content "android:gravity=" center "android:textsize=" 24SP "android:textcolor=" #00ff00 "Android Oid:text= "This is TextView"/>
2.Button
<button android:id= "@+id/button" android:layout_width= "match_parent" android:layout_height= "Wrap_ Content "android:text=" button "/>
3.EditText
<edittext android:id= "@+id/edit_text" android:layout_width= "Match_parent" android:layout_height= " Wrap_content "android:hint=" Type something Here "android:maxlines=" 2 "/>
4.ImageView
<imageview android:id= "@+id/image_view" android:layout_width= "Match_parent" android:layout_height = "Wrap_content" android:src= "@drawable/ic_launcher"/>
5.ProgressBar
<progressbar android:id= "@+id/progress_bar" android:layout_width= "Match_parent" android:layout_he ight= "wrap_content" style = "android:attr/progressbarstylehorizontal" android:max= "/>"
6.AlertDialog
Alertdialog.builder dialog = new Alertdialog.builder (this);d Ialog.settitle ("This is dialog");d ialog.setmessage (" Something important. "); Dialog.setcancelable (False);d Ialog.setpositivebutton ("OK", new Dialoginterface.onclicklistener () {@Overridepublic void OnClick (Dialoginterface dialog, int which) {//TODO auto-generated method stub}});d Ialog.setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {@Overridepublic void OnClick (dialoginterface arg0, int arg1) {//TODO auto-generated method stub}}); Dialog.show ();
7.ProgressDialog
ProgressDialog ProgressDialog = new ProgressDialog (this);p Rogressdialog.settitle ("This is ProgressDialog"); Progressdialog.setmessage ("Loading ...");p rogressdialog.setcancelable (True);p rogressdialog.show ();
Common properties can be checked.
Android Self-study notes