1. Width/height
Android:layout_width
Android:layout_height
Take value
Match_parent//Match parent control
Wrap_content//adaptive, based on content
If you specify a width, use the unit DP
2. The alignment position of the control in the parent control
Android:layout_gravity
3. How text is aligned in the control
Android:gravity
4. How elements in controls are arranged
Android:orientation
Value:
Horizontal level
Vertical Vertical
5. Text Size
Android:textsize
Unit SP
6. Text color
Android:textcolor
7. Important Attributes:
Android:layout_weight
Specifies the weight of the control in the screen
8.EditText:
Android:hint//Specify suggestive text
Android:maxlines//Specify the maximum number of rows
Android:text//Specify text
Java Gets the text:
Edittext.gettext (). ToString ()
9. Split Line:
Android:divider= "#ffffff"
Android:showdividers= "Middle"
10.ImageView Specify picture path:
Xml:
android:src= "@mipmap/ic_launcher"
Java:
Imageview.setimageresource (R.DRAWABLE.C);
11.ProgressBar Hidden display:
Xml:
Android:visibility= "Gone"
Java:
Progressbar.setvisibility (View.gone);
Value:
Gone is not visible, nor occupies a position
Visible: Viewable
Invisible: invisible, but placeholder
Visibility property for all Android controls
Progressbar.getvisibility () = = View.gone to determine whether a control is hidden to determine further action
12.ProgressBar:
Loading style: style= "? Android:attr/progressbarstyle"
Progress bar Style: style= "? Android:attr/progressbarstylehorizontal"
Progress bar Style:
Set the maximum value of the progress bar: android:max= "100"
Dynamically set size in Java:
int progress = progressbar.getprogress ();
Progress = progress + 10;
Progressbar.setprogress (progress);
13.AlertDialog Prompt Box:
Alertdialog's construction method is all protected, so it cannot be created by new and requires alertdialog.build
Java code:
Alertdialog.builder dialog = new Alertdialog.builder (mainactivity.this);
Dialog.seticon (R.drawable.zh); Set icon
Dialog.settitle ("hint"); dialog box title
Dialog.setmessage ("This is the hint"); dialog box Contents
Dialog.setcancelable (FALSE); Prevent the Back button from closing Alertdialog
Yes button
Dialog.setpositivebutton ("OK", new Dialoginterface.onclicklistener () {
@Override
public void OnClick (Dialoginterface dialog, int which) {
Toast.maketext (mainactivity.this, "OK", Toast.length_long). Show ();
}
});
No button
Dialog.setnegativebutton ("I know, close", new Dialoginterface.onclicklistener () {
@Override
public void OnClick (Dialoginterface dialog, int which) {
Toast.maketext (Mainactivity.this, "Canal", Toast.length_long). Show ();
}
});
Show dialog box
Dialog.show ();
14. button to determine:
V.getid () = = R.id.button
15.progressdialog:loading-Style dialog box
Java:
ProgressDialog ProgressDialog = new ProgressDialog (mainactivity.this);
Progressdialog.seticon (R.drawable.alert);
Progressdialog.settitle ("hint");
Progressdialog.setmessage ("Loading in ...");
Progressdialog.setcancelable (TRUE);
Progressdialog.show ();
Common Properties for Android controls