【发布时间】:2018-02-14 19:13:48
【问题描述】:
我想设置 app:layout_constraintHorizontal_bias="0.0" 以便我的 TextView 保持在左侧。当我通过将小圆圈拖到 0 来从布局编辑器设置它时,圆圈会移回默认值 50。也尝试从 xml 中执行此操作,但布局对偏差属性根本没有影响。
如果我删除正确的约束,文本会由于 wrap_content 宽度而离开屏幕。添加右约束(连同现有的左约束)需要我设置水平偏差以实现永久左对齐
This answer 建议为“父级”添加约束(我猜,而不是另一个视图),我尝试了它并将左右约束设置为父级,但仍然没有运气。 (左边是对图像视图的约束)
我尝试将其与另一个视图左对齐(通过选择 notification_subject 和 notification_body 并使用“对齐左边缘”),但布局仍然没有变化
这是我的文本视图
<TextView
android:id="@+id/notification_subject_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/notification_subject"
android:textAppearance="@style/TitleTextAppearance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toRightOf="@id/notification_item_iv"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
app:layout_constraintHorizontal_bias="0.0"/>
【问题讨论】:
标签: android android-studio android-constraintlayout