Common views
TextView, ImageView, ButtonViewNested View Groups
Putting views inside other views. Nesting can be costly and get expensive if there are too many layers of nesting.
Best practice using Android Views
- The view that contains all the views is the root view.
- Can organize material design cards into view groups, the button, icon and image inside the card are all nested views.
- The linearlayout horizontal and vertical orientations are extremely important.
- If the elements are not horizontally or vertically spread out, relative layout may be better.
- Draw a view hierarchy diagram to organize views
- Indent children views
- Set layout_width, layout_height dynamically using match_parent or wrap_content
No comments:
Post a Comment