当前位置:网站首页>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
边栏推荐
- Recommend a capacity expansion tool to completely solve the problem of insufficient disk space in Disk C and other disks
- Vector control of Brushless DC motor (4): sensorless control based on sliding mode observer
- JVM基础
- Use of kotlin basic common sets list, set and map
- Omron Ping replaces the large domestic product jy-v640 semiconductor wafer box reader
- 《MATLAB 神经网络43个案例分析》:第11章 连续Hopfield神经网络的优化——旅行商问题优化计算
- Custom view
- [FAQs for novices on the road] understand program design step by step
- Common websites and tools
- MFS详解(七)——MFS客户端与web监控安装配置
猜你喜欢
华为开发者认证与DevEco Studio编译器下载
Echart rectangular tree diagram: simple implementation of rectangular tree diagram
RN Metro packaging process and sentry code monitoring
Binary search
Omron Ping replaces the large domestic product jy-v640 semiconductor wafer box reader
Recommend a capacity expansion tool to completely solve the problem of insufficient disk space in Disk C and other disks
SSM框架整合--->简单后台管理
1+1 > 2, share creators can help you achieve
JS to realize bidirectional data binding
[one · data 𞓜 simple implementation of the leading two-way circular linked list]
随机推荐
Not in the following list of legal domain names, wechat applet solution
Echart histogram: echart implements stacked histogram
[written examination questions of meituan]
BlockingQueue source code
Free screen recording software captura download and installation
Jetpack - basic use of room
【虚拟机】 VMware虚拟机占用空间过大解决
Detailed explanation of the player startup process of ijkplayer code walk through
You should consider upgrading via
1+1 > 2, share creators can help you achieve
ADB shell CMD overlay debugging command facilitates viewing system framework character resource values
Kotlin collaboration channel
Usegeneratedkeys=true configuration
动态链接库嵌套样例
楊輝三角形詳解
Kotlin collaboration - flow+room database
Comprehensive overview of ijkplayer contour features for ijkplayer code walk through
Custom view - extensible collapsexpendview
【新手上路常见问答】一步一步理解程序设计
JetPack - - -WorkManger