Android 布局优化:RecyclerView 与 竖线布局
感谢提供布局文件。根据你提供的布局文件,以下是对应的修改建议:
- 删除多余的 TextView,因为在 RecyclerView 的 Adapter 中会创建并绑定 TextView。
<androidx.constraintlayout.widget.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='match_parent'
tools:context='.MainActivity'>
<androidx.recyclerview.widget.RecyclerView
android:id='@+id/recyclerView'
android:layout_width='match_parent'
android:layout_height='match_parent' />
<View
android:layout_width='2dp'
android:layout_height='match_parent'
android:background='@android:color/black'
tools:ignore='MissingConstraints' />
</androidx.constraintlayout.widget.ConstraintLayout>
请注意,这里只保留了 RecyclerView 和竖线的 View。
如果你还有其他问题或需要进一步的帮助,请随时提问。
原文地址: https://www.cveoy.top/t/topic/S17 著作权归作者所有。请勿转载和采集!