Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to apply the layout file in android

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to apply the layout file in android". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to apply the layout file in android" can help you solve the problem.

FrameLayout (frame layout)

This layout is the simplest layout form, the added components are displayed in a cascading way, the first control is at the bottom, and the last added control is at the top of the view display, somewhat similar to the form of stack. Here is an example of yourself:

This is a FrameLayout layout nested in RelativeLayout. And there are two overlapping p_w_picpathView objects in the FrameLayout layout.

2. AbsoluteLayout (absolute layout)

Child controls in this layout need to specify the horizontal and vertical coordinates of the relative position of their coordinates, otherwise the layout will be arranged in the upper-left corner like the FrameLayout layout. This layout does not automatically adapt to the screen size, so use less, here is a brief introduction to the definition.

3.TableLayout (Table layout)

Definition: places child control elements in rows and columns and does not display row and cell boundaries. Each line is either a TableRow or a View object. Add a control to TableRow every day to represent a column.

Attribute parameter description:

Android:layout_colum: sets the column in which the control resides in TableRow.

Android: layout_span: sets the number of columns this control spans.

The columns specified by android:collapseColumns:TableLayout are hidden, multiple columns are hidden, and the hidden classes are separated by commas.

Android:StretchColumns: specified columns that can be stretched, multiple columns stretched, separated by commas.

Android:shrinkColmns: sets the specified column that can be shrank.

4.LinearLayout (linear layout)

Definition: align all child elements in one direction (vertical or horizontal), each row in a vertical list has only one child element, and a horizontal list is just a column height.

5.RelativeLayout (relative layout)

Definition: according to the layout, the sub-controls are laid out relative to the reference controls and parameters they set. The reference control can be a parent control or other child control, but the referenced space must be defined before the control that references it.

There are many attribute parameters in the relative layout, and the layout format is also more important. Describe the property parameters of the relativeLayout layout:

Android:layout_centerHorizontal level is in the middle

Android:layout_centervertical is vertically centered

The android:layout_centerInParent is completely centered relative to the parent element

Android: layout_alignparentBottom is close to the lower edge of the parent element

Android:layout_alignparentLeft

Android:layout_alignParentRight

Android:layout_alignparentTop

Android:layout_alignwithparentifmissing uses the parent element as a reference if the corresponding sibling element cannot be found

Android:layout_below= "id/id-name" is under an element

Android:layot_top

Android:layout_toLeftof

Android:layout_toRightof

Android:layout_alignTop the upper edge of this element is aligned with the upper edge of an element

Android:layout_alignBottom

Android:layout_alignLeft

Android:layout_alignRight

The distance of the android:layout_marginBottom from the bottom edge of an element

Android:layout_margintop

Android:layout_marginleft

Android:layout_marginright

This is the end of the introduction on "how to apply layout files in android". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report