In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "how to use ConstraintLayout layout in android", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use ConstraintLayout layout in android" article.
1. To use ConstraintLayout, you need to introduce the following into the build.gradle of app:
Compile 'com.android.support.constraint:constraint-layout:1.0.2'
2. First, take a look at a simple xml and image effect:
It is not difficult for visitors to see that the four simple Textview distribution locations in xml take id as the first control of tv as the benchmark, the second control is below the first control, and all on the left side of the entire layout; the third control is on the lower left of the entire parent layout; and the fourth control is on the right side of the first control.
If you look closely, each Textview has similar properties:
For example, the first control:
App:layout_constraintTop_toTopOf= "parent"
Of the second control
App:layout_constraintTop_toBottomOf= "@ + id/tv1"
It literally means:
An edge of the control is aligned with an edge of a control.
For example, the first control aligns the upper part of the control with the upper part of the parent layout, which naturally makes the first control at the top left; the top of the second control is aligned with the bottom of the first control, the id=tv1, and the second control is naturally located directly below the first control. Others can follow suit.
Now let's stipulate a layout and try it again to make the most common layout.
The code is as follows:
App:layout_constraintTop_toTopOf= "parent" / app:layout_constraintRight_toLeftOf= "parent" android:layout_marginRight= "10dp" / app:layout_constraintTop_toBottomOf= "@ + id/tv1" / app:layout_constraintRight_toLeftOf= "parent" app:layout_constraintTop_toBottomOf= "@ + id/tv1" android:layout_marginRight= "10dp" / above is about how to use ConstraintLayout layout in android. I believe everyone has some understanding. I hope the content shared by the editor will be helpful to all of you. If you want to know more about the relevant knowledge, please follow 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.