1 staged section
-
layout
linear layout
relative layout
table layout
frame layout
constraint layout
-
control
Basic controls:
TextView
common attributes
Set the border of the text box (resource file)
text box with picture
EditText
common attributes
hint
inputType
ImageView
common attributes
src
scaleType
Button inherits from TextView
common attributes
Use of resource files
stateDrawableList
Click event (4 click events, 3 masters, 1 understanding)
inner class
anonymous inner class
Implement the interface (there are many buttons in the Activity)
ImageButton
common attributes
RadioButton -- RadioGroup
common attributes
If there are multiple RadioButtons, they need to be placed in RadioGroup for grouping
The RadioGroup arrangement is vertical by default, and can be changed to horizontal by modifying the orientation
Click event needs to set RadioGroup
CheckBox check
The use of common attributes
click event
Advanced controls:
ScrollView
ScrollView has and can only have one child view (layout - LinearLayout or RelativeLayout)
If the height in the subview is not higher than the scrollView, it cannot slide
You can only slide vertically, not horizontally. If you want to slide horizontally, you need to use HorizonalScrollView
slide top, slide bottom
2 Today's content
ProgressBar progress bar
PopuoWindow popup box
Dialog dialog box (key)
Spinner drop-down box (focus)
Jump between Activities
Intent intent = new Intent(MainActivity.this, MainActivity2.class); startACtivity(intent);
ProgressBar into the bar
Progress bar classification?
Divided into rotating progress bar and horizontal progress bar ,
PopupWindow pop-up box (not generated by dragging and dropping)
You can load a view or import a custom xml layout
What should I do to load a view?
How to import custom layout?
1. Customize a layout.xml file under layout
2. Convert the xml file to view
Dialog dialog box (not generated by dragging and dropping)
The difference between Dialog and PopupWindow?
PopupWindow
It is non-modal, and you can continue to operate the controls under the pop-up interface;Dialog
It is modal, you must cancel the Dialog before you can operate the controls under the Dialog;
What should a basic dialog contain?
title
content
button
Kind of dialog?
1. Ordinary dialog box 2. List dialog box 3. Single selection dialog box 4. Multiple selection dialog box 5. Waiting dialog box 6. Progress bar dialog box 7. Custom dialog box
Spinner drop-down box
static assignment
Read the data in Strings.xml and load the data into the spinner
how to operate
1. Define a String-array in values/strings.xml 1. Just add the attribute entries in Spinner, and call string-array in this attribute
dynamic assignment
ArrayAdapter
How to get the value?
Use with buttons
The click event is placed on the button
independent use
Click events can only be placed on Spinner