【发布时间】:2020-03-25 08:59:52
【问题描述】:
我有一个约束布局,当字符串足够长时,它会与右侧的元素重叠。示例代码为:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iconIv"
android:layout_width="36dp"
android:layout_height="36dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/nameTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/iconIv"
app:layout_constraintTop_toTopOf="parent"/>
<FrameLayout
android:id="@+id/priceFl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
...
然后我尝试 nameTv 像这样app:layout_constraintRight_toLeftOf="@id/priceFl" 将右侧约束添加到右侧元素的左侧,这发生了:
有没有办法将此文本放置在图标视图和价格视图之间?
【问题讨论】:
-
这里可以加xml代码吗
-
@MayankPanchal,你能再看看吗?
标签: android layout android-constraintlayout