The main layout is the View (specifically inherits ViewGroup) designed with the purpose of containing child views and controls, arranging the position of those sub views on the screen, each layout has a position control mechanism. View your own child. There are some layouts that you refer to first as:
- FrameLayout simply provides a screen area, often using it to display a single child view. If you set multiple child views, then the default child views will overlap. However, the position of the child views in it can also be adjusted through the value of gravity parameters, for example, in the subview set android: layout_gravity = "bottom | right", the child view is located to the left, bottom of FrameLayout.
- ConstraintLayout (introduced in Android 7), using this layout is recommended for most cases. ConstraintLayout allows to control the position and application of child views in the layout by simply binding to each child view. From there, a complex layout can easily be created that uses at least nesting in the layout (this layout is in another layout) to help improve speed. ConstraintLayout is also integrated into the Android Studio Layout Editor, so you can visually adjust the child views in this layout.
- LinearLayout with this layout, the child views are lined up (linear) in a row or a column (depending on the design set direction layout). There is a weight value that can be assigned to each child view to indicate how much space that child view occupies in a proportion that correlates with other child views.
- RelativeLayout allows child-based child views to be related to other sub-views and parent views through align and margin parameters. For example, a child View is set in the middle of RelateiveLayout (android: layout_centerInParent = "true"), another child can be set to align right with this View (android: layout_alignRight = "@ + id / other")
- GridLayout is divided into a grid of several rows and some columns to contain child views.
- TableLayout provides the ability to arrange child views into a grid of tables (including rows and columns). A row of the table represents the TableRow child view object, which contains the child View element as table cells.
- CoordinatorLayout it is designed to have the interaction of the child View in it, especially used with ActionBar, FloatingActionButton, Snackbar ...
No comments:
Post a Comment