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 is the layout in Android?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, the editor will share with you the relevant knowledge about the layout of Android. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

1. FrameLayout

This layout can be seen as a pile of things at the foot of the wall. there is a square rectangular upper-left corner of the wall. We put * things, and if we want to put another one, we will put them on top of the original position. If we put them in turn, they will cover the original things. This layout is relatively simple, and can only put some relatively simple things.

II. LinearLayout

Linear layout, this thing, from the frame can be understood as a div, it is first listed from the top down on the screen. Each LinearLayout can be divided into a vertical layout (android:orientation= "vertical") and an android:orientation= "horizontal" layout. In vertical layout, there is only one element in each row, and multiple elements go down vertically in turn; in horizontal layout, there is only one row, and each element is arranged to the right in turn.

There is an important attribute android:layout_weight= "1" in linearLayout. This weight represents line spacing in vertical layout, column width in horizontal layout, and higher weight value.

III. AbsoluteLayout

Absolute layout as if div specified the absolute attribute, using XMagi Y coordinates to specify the location of the element android:layout_x= "20px" android:layout_y= "12px" this layout is also relatively simple, but in the vertical switch casually, there are often problems, and multiple elements, the calculation is more troublesome.

IV. RelativeLayout

Relative layout can be understood as a way of positioning a certain element as a reference. The main attributes are:

Relative to a certain element

Android:layout_below= "@ id/aaa" this element is below where id is aaa

To the left of the android:layout_toLeftOf= "@ id/bbb" change element is bbb.

Relative to the parent element

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

Android:layout_alignParentRight= "true" is aligned to the right of the parent element

You can also specify margins, etc. For more information, please see API

V. TableLayout

The table layout is similar to Table in Html. Each TableLayout has a table line TableRow,TableRow that defines each element and sets its alignment android:gravity=.

These are all the contents of the article "what is the layout in Android?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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