About
All the UI elements extends from the view class
- a container (viewgroup) is a subclass of a view object
- a simple widget is also a subclass of a view object.
Views are rectangle on the screen (same concept than box in CSS) where you may or may not view the borders.
A View occupies a rectangular area on the screen and is responsible for:
- drawing
- and event handling.
If you want to group simple widgets, you need a container descending from a ViewGroup
Articles Related
ID
List
See design component
Properties
Visibility
Dimension (Width and Height)
Width and height can have only two values:
- wrap_content
- or match_parent
There is then 4 possible combinations and possible outcomes when the view is in a parent (green)
Gravity
Gravity of a view (Red) in a parent (green)
Padding vs Margin
Type
Scroll
ScrollView: Extension of the FrameLayout class (meaning you should place one child in it containing the entire contents to scroll) that allows the user to scroll vertically to reveal more content than can be displayed on screen at once. The ScrollView is often used to contain a vertically oriented LinearLayout into which you can place any linear layout that in turn arranges each item it contains into a vertical list.
List
Management
Get
by id
Button myButton = (Button) findViewById(R.id.my_button);