ConstraintLayout 中的右侧文本视图,文本被切断
Right Text view in ConstraintLayout, text is cutting off
我在 android 中使用 ConstraintLayout 布局。我想要我的图片在左边,我的文字在我的图片右边。
<?xml version="1.0" encoding="utf-8"?
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/galleryImg"
android:layout_width="150dp"
android:layout_height="150dp"
android:onClick="toggleMode"
android:layout_marginLeft="10dp"
android:scaleType="centerCrop"
android:src="@drawable/slider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent"
/>
<TextView
android:id="@+id/galTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Quick Brown Fox Jumps Over Quick Brown Fox Jumps Over"
android:textSize="18sp"
android:layout_alignParentRight="true"
app:layout_constraintStart_toEndOf="@+id/galleryImg"
app:layout_constraintTop_toTopOf="@+id/galleryImg" />
</android.support.constraint.ConstraintLayout>
但是我的文字在右侧被截断了——如果我的文字在第一行结束 over.. 它只显示 ov 下一行以 Quick.
开头
在这里,这应该有效:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/galleryImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:contentDescription="TODO"
android:src="@drawable/slider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/galTitle"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Quick Brown Fox Jumps Over Quick Brown Fox Jumps Over"
app:layout_constraintBottom_toBottomOf="@+id/galleryImg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/galleryImg"
app:layout_constraintTop_toTopOf="@+id/galleryImg"/>
</android.support.constraint.ConstraintLayout>
我在 android 中使用 ConstraintLayout 布局。我想要我的图片在左边,我的文字在我的图片右边。
<?xml version="1.0" encoding="utf-8"?
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/galleryImg"
android:layout_width="150dp"
android:layout_height="150dp"
android:onClick="toggleMode"
android:layout_marginLeft="10dp"
android:scaleType="centerCrop"
android:src="@drawable/slider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent"
/>
<TextView
android:id="@+id/galTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Quick Brown Fox Jumps Over Quick Brown Fox Jumps Over"
android:textSize="18sp"
android:layout_alignParentRight="true"
app:layout_constraintStart_toEndOf="@+id/galleryImg"
app:layout_constraintTop_toTopOf="@+id/galleryImg" />
</android.support.constraint.ConstraintLayout>
但是我的文字在右侧被截断了——如果我的文字在第一行结束 over.. 它只显示 ov 下一行以 Quick.
开头在这里,这应该有效:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/galleryImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:contentDescription="TODO"
android:src="@drawable/slider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/galTitle"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Quick Brown Fox Jumps Over Quick Brown Fox Jumps Over"
app:layout_constraintBottom_toBottomOf="@+id/galleryImg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/galleryImg"
app:layout_constraintTop_toTopOf="@+id/galleryImg"/>
</android.support.constraint.ConstraintLayout>