java - ConstraintLayout 奇怪的约束线
问题描述
我正在使用约束布局,据我了解,它会使 UI 在不同的屏幕尺寸上看起来相似。问题是我无法将约束线从日历视图拖到 textView
因此,我创建了我需要使用的约束线
app:layout_constraintBottom_toTopOf="@+id/appfortday"
图片:https ://imgur.com/a/xG1eCH6
它创造了这条奇怪的摆动线而不是正常的之字形线。这些行之间有什么区别?它会表现得像一条正常的约束线吗?
这是我的 xml 的一部分:
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textcalender"
android:layout_marginTop="56dp"
app:layout_constraintBottom_toTopOf="@+id/appfortday"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textcalender" />
<TextView
android:id="@+id/appfortday"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Appointments for today"
android:textSize="15dp"
app:layout_constraintBottom_toTopOf="@+id/feelingsrec"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/calendarView"
app:layout_constraintVertical_bias="0.49" />
我想知道这些行之间的区别,以及它是否会影响我的 UI 在不同屏幕尺寸上的显示方式。谢谢
解决方案
“摇摆不定”的线表明,两个视图具有指向彼此的约束。
calendarView
对顶部有约束,appfortday
反之亦然。
还行吧。如果您的视图具有相互指向的约束,您可以通过添加链样式来更改它们的对齐方式。
推荐阅读
- r - 如何在不重新分配的情况下从 C char* ptr 创建 RAWSXP 向量
- typescript - typescript 返回接口的属性数据,返回类型定义
- python - 为什么我不能将此列表转换为不规则张量?
- java - 如何在 dynamodb java aws sdk 2.x 的本地实例中配置端点?
- facebook - Facebook OpenGraph 问题
- javascript - 使用带有两个映射的三元运算符
- python - 即使在烧瓶中设置后,密钥也会出错
- python - 将数据插入 Postgres SQL 时处理错误
- c++ - 错误 C2102:“&”需要左值,VS2019。怎么修?
- .net - 如何使用 OpenXML 从 Word 中获取嵌入文档与其媒体文件之间的关系