1.2 Views, Layouts, and Resources
1.2 Views, Layouts, and Resources
Hello World
Lesson 1
Button CheckBox
RadioButton
EditText
Switch
SeekBar
● XML Files
● Programmatically
Visual representation of
what's in XML file.
View, Layouts, This work is licensed under a
Android Developer Fundamentals and Resources Creative Commons Attribution-NonComm 10
ercial 4.0 International License
Using the Layout Editor
1. Resizing handle
2. Constraint line and handle
3. Baseline handle
4. Constraint handle
android:<property_name>="@<resource_type>/resource_id"
Example: android:text="@string/button_label_next"
android:<property_name>="@+id/view_id"
Example: android:id="@+id/show_count"
linearL.addView(myText);
setContentView(linearL);
● View:
R.id.recyclerview
rv = (RecyclerView) findViewById(R.id.recyclerview);
● String:
In Java: R.string.title
In XML: android:text="@string/title"
View, Layouts, This work is licensed under a
Android Developer Fundamentals and Resources Creative Commons Attribution-NonComm 39
ercial 4.0 International License
Measurements
● Device Independent Pixels (dp) - for Views
● Scale Independent Pixels (sp) - for text