Android的约束布局不会保存大量文本

问题描述:

目前在Android中的约束布局中工作,并且布局在回收器视图中一遍又一遍平铺。当我将textview限制在屏幕的左侧,边距为8dp,然后用8dp的边距将其限制在右侧的图像上时,我将宽度设置为包裹内容和高度,以便它可以移动如果内容太大,则根据需要制作更多行。文字通过图像,有时甚至离开屏幕左侧,完全忽略了这些限制?难道我做错了什么?由于在回收站视图中平铺了一遍又一遍,因此,约束布局设置为父宽度并将内容高度包装。Android的约束布局不会保存大量文本

<?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" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
tools:layout_editor_absoluteY="25dp" 
tools:layout_editor_absoluteX="0dp"> 

<TextView 
    android:id="@+id/titleTextView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="TextView" 
    android:layout_marginStart="122dp" 
    android:layout_marginEnd="121dp" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginTop="16dp" 
    app:layout_constraintRight_toLeftOf="@+id/imageView" 
    android:layout_marginRight="8dp" 
    android:layout_marginLeft="8dp" 
    app:layout_constraintLeft_toLeftOf="parent" /> 

<TextView 
    android:id="@+id/descriptionTextView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="0dp" 
    android:layout_marginEnd="8dp" 
    android:layout_marginLeft="8dp" 
    android:layout_marginRight="8dp" 
    android:layout_marginStart="8dp" 
    android:layout_marginTop="8dp" 
    android:padding="10dp" 
    android:text=" asdkjasdkjfasd sdafkjdsafkjasfd fsdkjsafdkjsafd" 
    app:layout_constraintBottom_toBottomOf="parent" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toLeftOf="@+id/imageView" 
    app:layout_constraintTop_toBottomOf="@+id/titleTextView" 
    app:layout_constraintVertical_bias="0.0" 
    app:layout_constraintHorizontal_bias="0.0" /> 

<ImageView 
    android:id="@+id/imageView" 
    android:layout_width="75dp" 
    android:layout_height="81dp" 
    app:srcCompat="@mipmap/attk_logo" 
    android:layout_marginEnd="8dp" 
    app:layout_constraintTop_toTopOf="parent" 
    android:layout_marginTop="8dp" 
    android:layout_marginRight="8dp" 
    app:layout_constraintRight_toRightOf="parent" /> 
</android.support.constraint.ConstraintLayout> 

在这里编辑http://prntscr.com/es6bhs

布局的图片替换此代码与TextView的

<TextView 
     android:id="@+id/descriptionTextView" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="0dp" 
     android:layout_marginEnd="8dp" 
     android:layout_marginLeft="8dp" 
     android:layout_marginRight="8dp" 
     android:layout_marginStart="8dp" 
     android:layout_marginTop="8dp" 
     android:padding="10dp" 
     android:text="asdkjasdkjfasd gdgh sd ds fj fg sj gsdfjgj jsdf gsf j sdafk jdsaf kjasfd fsd kjsaf dkjsafd" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toLeftOf="@+id/imageView" 
     app:layout_constraintTop_toBottomOf="@+id/titleTextView" 
     app:layout_constraintVertical_bias="0.0" 
     app:layout_constraintHorizontal_bias="0.484" />