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

What are the layouts in Android

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will share with you about the layout of Android. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

LinearLayout linetype layout

Android:orientation (direction) = "vertical" (vertical) or "horizontal" (horizontal)

Android:gravity (gravity) = "center"

Center_vertical vertical (Y axis) center

Center_horizontal horizontal (X axis) center

Center is all centered

The right subclass control is located on the right side of the current layout

The left subclass control is located on the left side of the current layout

Under bottom

If you set the match_parent and then set the weight in the linetype layout, it will be inversely proportional to the occupation.

Layout_gravity adjusts the position of the layout relative to the parent layout (for LinearLayout use only)

Gravity is the location where the sublayout of the layout is adjusted.

Relative layout of RelativeLayout

The sublayout has a gravity attribute, but no layout_gravity attribute

Android:layout_alignParentLeft= "true" is to the left of the parent container

Android:layout_marginLeft= "36dp" distance to the left of the parent class

Android:layout_centerInParent= "true" is centered in the parent class

Android:layout_centerHorizontal= "true" is horizontally centered in the parent class

Android:layout_below= "@ id/view" is below view

Android:layout_above= "@ id/view" is above

Android:layout_toLeftOf= "@ id/view" is on the left

Android:layout_alignBaseline= "@ id/view" itself aligns with view content

Android:layout_alignBottom= "@ id/view" aligns with the bottom of view

FrameLayout frame layout

In this layout, none of the child elements can be specified, they are all placed in the upper-left corner of the area, and the subsequent child elements directly cover the previous child elements.

There is no gravity attribute either, but the subclass has a layout_gravity attribute.

Set the foreground view, in front of all child views

Android:foreground

Set background

Android:background

Keep the screen awake

Android:keepScreenOn

Set the location of the foreground map

Android:foregroundGravity

AbsoluteLayout absolute layout

Also known as coordinate layout, you can directly specify the absolute location of child elements (XY)

The adaptability is poor due to different screen size of the equipment.

Set the location with the upper left corner as the starting point:

Android:layout_x= "35dp" control subclass X position

Android:layout_x= "35dp" Y position

TableLayout table layout

Manage subspaces in the form of rows and rows, one TableRow object for each behavior, or a View

Global attributes:

Android:collapseColumns= "1BI 2"

Hides index columns starting at 0. Columns are separated by commas: 1, 1, 2, 5

Android:shrinkClumns= "1BI 2"

Shrink the index column starting at 0. When the retractable columns are too wide (too much content) to be squeezed out of the screen, the columns must be separated by commas: 1 Magi 2 Jing 5 can shrink all columns by * instead. A column can represent both contraction and stretch.

Android:stretchClumns= "1BI 2"

Stretch the index column starting at 0 to fill the remaining blank space. Columns are separated by commas, and you can use * instead of stretching all

Local attributes (attributes used by the interior space):

Android:layout_column= "1" the space is displayed in the second column

Android:layout_span= "2" this control occupies 2 columns

Thank you for reading! This is the end of this article on "what is the layout in Android?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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