android - 2.0.2版本的约束布局及其尺寸比属性发生了什么变化?
问题描述
我有这样的 ImageView 设置
<ImageView
android:layout_width="0dp"
android:layout_height="@dimen/video_file_item_image_height"
android:background="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
和
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
看起来像这样
但与
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
ImageView 不可见
更新
版本 2.0.3 它仍然没有修复,它只有在你没有设置 dp 的高度时才有效(例如你设置wrap_content
了)并且app:layout_constraintEnd_toEndOf=
也是必需的,但它的工作方式不同,我需要在 DPI 中设置高度!它在 2.0.1 中像这样工作,app:layout_constraintEnd_toEndOf=
不需要设置
解决方案
看起来这是一个已知问题:https ://issuetracker.google.com/issues/170313444
推荐的解决方法是将其添加到您的ConstraintLayout
标签中:
app:layout_optimizationLevel="cache_measures"
推荐阅读
- command-prompt - 无法退出太长的列表
- windows - 将 curl 帖子的输出与 IF ELSE 语句一起使用
- batch-file - 如何使用 for 命令从文本文件中捕获数据并将其设置为变量(Windows 命令提示符)
- powerbi - Powerbi 计算表上两列值的差异
- c# - 禁用验证 onload 并在属性上实现 INotifyPropertyChanged
- sql - 按组上的条件选择寄存器
- php - 如何从mysql表中的纯文本中检测url并在表行中回显
- excel - 根据单元格中的文本和下面的单元格插入行
- jquery - 查找引号之间的字符串,将类添加到 this.string 并隐藏引号
- php - 从 PHP 中的存储过程获取输出