我有一个简单的RecyclerView
使用 2 个字符串。一旦第二个TextView
获得多行文本,它就会被剪掉,而不是仅仅扩大视图的高度。
例如,两个 textView 收到的文本是:
"Director":"Cate Shortland"
"Writer":"Jac Schaeffer (story by), Ned Benson (story by), Eric Pearson (screenplay by), Stan Lee (based on the Marvel comics by), Don Heck (based on the Marvel comics by), Don Rico (based on the Marvel comics by)"
我的观点:
<androidx.constraintlayout.widget.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="wrap_content"
android:id="@+id/layout">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textview"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/detial"
app:layout_constraintStart_toEndOf="@+id/detial" />
<TextView
android:id="@+id/detial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:maxWidth="250dp"
android:text="@string/year"
android:maxLines="24"
android:textSize="18sp"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
我尝试从更改wrap_content
为match_parent
,添加android:inputType="textMultiLine"
并检查它RecyclerView
是最新版本(因为早期版本有一些错误)。有什么我可以尝试的想法吗?