当前位置:网站首页>Subtotal of constraintlayout
Subtotal of constraintlayout
2022-06-13 06:34:00 【Sindyue】
ConstraintLayout You can reduce the nesting of layouts , The aspect ratio can also be fixed , To a certain extent, it meets the needs of the project , There are a few easily forgotten points , recorded .
1. Fixed aspect ratio
constraintDimensionRatio To make ( Such as :app:layout_constraintDimensionRatio=”1:3” Indicates that the aspect ratio is 1:3) The following conditions are required for this attribute to take effect :
1)left ,right ,top ,bottom All four edges need constraints ,bottom The constraint of can be used baseline Instead of .
2) At least one of the width and height is 0dp perhaps -1dp, If it's all 0dp Will be displayed in the maximum range of the parent layout .
2.GuideLine Use
Guideline yes ConstraintLayout Of Guideline Utility classes for helper objects , The helper does not appear on the device , It is defaulted to View.GONE, And it cannot be changed . in addition ,Guideline It's for ConstraintLayout Created , That is, it can only be used for ConstraintLayou Layout .
<android.support.constraint.Guideline
android:id="@+id/guide_line_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
The above is an example of a split line in the middle of a horizontal direction , Here are some instructions :
vertical Guideline The width is 0, The height is ConstraintLayout Height
level Guideline The width is ConstraintLayout Width , The height is 0
GuideLine It can also be thought of as a view , It can be based on the dp Or percentage , take GuideLine Position in layout , There are three ways to determine the position :
layout_constraintGuide_begin: Specify a fixed distance from the left or top of the layout (dp)
layout_constraintGuide_end: Specify a fixed distance from the right or bottom of the layout (dp)
layout_constraintGuide_percent: Specify a percentage of the width or height of the layout
边栏推荐
- The processing and application of C language to documents
- Detailed explanation of PHP distributed transaction principle
- [DP 01 backpack]
- 本地文件秒搜工具 Everything
- Overview of demoplayer program framework design of ijkplayer
- 【js】var、let、const
- Solutions to common problems in small program development
- Using async await in applets
- 华为开发者认证与DevEco Studio编译器下载
- Kotlin data flow - flow
猜你喜欢
Super model logo online design and production tool
MFS详解(六)——MFS Chunk Server服务器安装与配置
The boys x pubgmobile linkage is coming! Check out the latest game posters
Learning records countless questions (JS)
JetPack - - - Navigation
Echart histogram: echart implements stacked histogram
【2022高考季】作为一个过来人想说的话
MFS詳解(七)——MFS客戶端與web監控安裝配置
MFS details (vii) - - MFS client and Web Monitoring installation configuration
[virtual machine] VMware virtual machine occupies too much space. Solution
随机推荐
Ijkplayer code walk through H264 unpacker application details
Simple use of event bus
线程相关点
Custom view
Dragon Boat Festival wellbeing, use blessing words to generate word cloud
[kernel] two methods of driver compilation: compiling into modules and compiling into the kernel (using miscellaneous device driver templates)
Wechat applet: use of global state variables
Thread pool learning
Scrcpy source code walk 3 what happened between socket and screen refresh
二分查找
Detailed explanation of Yanghui triangle
BlockingQueue source code
电镀挂具RFID工序管理解决方案
JetPack - - -WorkManger
MFS details (VII) -- MFS client and web monitoring installation configuration
Using the shutter floor database framework
Thread correlation point
Detailed explanation of scrcpy client code walk through H264 raw stream decoding process
Analysis of 43 cases of MATLAB neural network: Chapter 11 optimization of continuous Hopfield Neural Network -- optimization calculation of traveling salesman problem
华为开发者认证与DevEco Studio编译器下载