Mee*_*wal 0 android textview android-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>
Run Code Online (Sandbox Code Playgroud)
但是我的文字在右侧被切断 - 就像如果我的文字在第一行结束.. 它只显示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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1509 次 |
| 最近记录: |