layout

       The layout is an extension of the ViewGroup class, which is used to control the position of the child controls in the UI. The layout can be nested. Therefore, you can use the combination of multiple layouts to create any complex interface.


        Classification of layouts:

                            LinearLayout (linear layout)

                            FrameLayout

                            RelativeLayout (relative layout)

                            AbsoluteLayout: Deprecated

                            TableLayout (absolute layout): Deprecated


        LinearLayout (layout):

                                           direction:

                                                    The default is horizontal

                                                                     android:orientation="horizontal"

                                                    cVertical direction:

                                                                      android:orientation="vertical"

                                            Weights:

                                                     The width of the child controls is evenly divided horizontally

                                                     The height of the child controls is equally divided vertically


        FrameLayout (layout)

                                          Place each subview within the border. The default position is the upper left corner, but you can use the grain property to change its position. When adding multiple subviews, he will stack each new subview on the previous subview. above, and each new subview may obscure the previous one.

                                            Overlapping phenomenon will occur, the more later, the more displayed

                                            Common properties:

                                                          android:layout_gravity="center"

                                                                                      optional value

                                                                                                center

                                                                                                center_vertical

                                                                                                center_horizontal

        RelativeLayout:

                                              The child control defaults to its upper left corner

                                              overlap occurs

                                              When configuring child controls, you need to consider

                                                                                   Against whom?

                                                                                                     relative to the parent control

                                                                                                                    Attributes:

                                                                                                                            alignParentRight (align right)

                                                                                                                            alignParentLeft (align left)

                                                                                                                            alignParentTop (top alignment)

                                                                                                                            alignParentBottom (bottom alignment)

                                                                                                  Relative to sibling controls

                                                                                                                       Attributes:

                                                                                                                                above

                                                                                                                                below

                                                                                                                                toLeftOf

                                                                                                                                toRightOf

                                                                                                                                alignLeft

                                                                                                                                alignRight

                                                                                                                                alignTop

                                                                                                                                alignBottom

                                                                                                                                

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326467242&siteId=291194637