Rus*_*mov 6 layout android android-constraintlayout
我有一个约束布局,当字符串足够长时,它将与右侧的元素重叠。示例代码为:
<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>
...
Run Code Online (Sandbox Code Playgroud)
然后我试图给TV命名,以在右边的元素的左边添加右边的约束,就像这样app:layout_constraintRight_toLeftOf="@id/priceFl"
,这发生了:
有没有办法在图标和价格视图之间放置此文本?
尝试这个
<TextView
android:id="@+id/nameTv"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/iconIv"
app:layout_constraintRight_toLeftOf="@+id/priceFl"
app:layout_constraintTop_toTopOf="parent"/>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5125 次 |
最近记录: |