当前位置:网站首页>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
边栏推荐
- Detailed explanation of the player startup process of ijkplayer code walk through
- Wechat applet (pull-down refresh data) novice to
- Dynamic link library nesting example
- Kotlin basic objects, classes and interfaces
- Simple use of event bus
- Local file search tool everything
- [JS] array de duplication
- Learning records countless questions (JS)
- Echart histogram: X-axis displays value, Y-axis displays category
- Common websites and tools
猜你喜欢

JVM基础

SSM framework integration -- > simple background management

Hbuilderx: installation of hbuilderx and its common plug-ins

The web server failed to start Port 7001 was already in use

【新手上路常见问答】一步一步理解程序设计

MFS details (vii) - - MFS client and Web Monitoring installation configuration

Echart line chart: multiple line charts show only one line at a time

JVM Foundation

The boys x pubgmobile linkage is coming! Check out the latest game posters

MFS explanation (V) -- MFS metadata log server installation and configuration
随机推荐
杨辉三角形详解
Scrcpy development environment construction and source code reading
Custom view - extensible collapsexpendview
[one · data 𞓜 simple implementation of the leading two-way circular linked list]
Detailed explanation of PHP distributed transaction principle
Dynamic link library nesting example
本地文件秒搜工具 Everything
Echart line chart: multiple line charts show only one line at a time
JetPack - - - DataBinding
ADB shell CMD overlay debugging command facilitates viewing system framework character resource values
MFS explanation (VI) -- MFS chunk server installation and configuration
Wechat applet (get location)
Analysis of 43 cases of MATLAB neural network: Chapter 10 classification of discrete Hopfield Neural Network -- evaluation of scientific research ability of colleges and Universities
[2022 college entrance examination season] what I want to say as a passer-by
Hbuilderx: installation of hbuilderx and its common plug-ins
El form form verification
‘ipconfig‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。
IOError(Errors.E050.format(name=name))
Local file search tool everything
You should consider upgrading via