In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "what is the use of the Layout.xml attribute in Android". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the use of the Layout.xml attribute in Android"?
Android has Layout:FrameLayout,LinearLayout,TableLayout,RelativeLayout,AbsoluteLayout.
The XML property of the View that is laid out in Layout:
1. XML attributes common to Item in several Layout:
(1) layout_width
(2) layout_height
(3) layout_marginLeft
(4) layout_marginTop
(5) layout_marginRight
(6) layout_marginBottom
(7) layout_gravity
FrameLayout is the simplest Layout and has only these attributes.
LinearLayout will also have:
(8) layout_weight
The line TableRow of TableLayout is a horizontal LinearLayout.
RelativeLayout has 16 align-related XML attributes:
(9) layout_above
(10) layout_alignBaseline
(11) layout_alignBottom
(12) layout_alignLeft
(13) layout_alignParentBottom
(14) layout_alignParentLeft
(15) layout_alignParentRight
(16) layout_alignParentTop
(17) layout_alignRight
(18) layout_alignTop
(19) layout_below
(20) layout_centerHorizontal
(21) layout_centerInParent
(22) layout_centerVertical
(23) layout_toLeftOf
(24) layout_toRightOf
(1) and (2) are used to determine the width and height of the View placed in the Layout: their possible values are fill_parent,wrap_content or fixed pixel values.
(3) (4) (5) (6) is that the View placed in the Layout expects it to be at a distance from the boundary of the Layout or other View.
(7) it is used to determine the docking position of View in Layout.
(8) used to allocate the remaining space after arranging all the child View in LinearLayout to each View that owns this attribute according to their layout_weight.
(9) to (24) are used to determine the position of View in RelativeLayout relative to Layout or other View in Layout.
According to the Android documentation, Android traverses the tree composed of Layou and View twice, once a measure call to determine the size of the Layout or View, and a layout call to determine the location of the Layout or view. Of course, my own copycat implementation merged these two calls together. That is, Layout measure itself once before arranging, and then call the Layout method recursively on the View. The size of this must be determined. Then use the determined size to use the gravity or align attribute to locate, and use margin to adjust the position.
At this point, I believe you have a deeper understanding of "what is the use of the Layout.xml attribute in Android?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.