用Kotlin写RecyclerView,item使用RelativeLayout的问题,Item的间距会越来越大
16lz
2021-12-04
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/article_list_pic" android:layout_width="match_parent" android:layout_height="@dimen/dimen_300px"/> <TextView android:id="@+id/article_list_title" android:layout_width="match_parent" android:layout_height="@dimen/dimen_100px" android:below="@id/article_list_pic" android:maxLines="2" android:ellipsize="end" android:textColor="@color/black"/></RelativeLayout>
当上面的布局作为RecyclerView的Item时,且父节点为RelativeLayout的时候,各个Item的间距会在滚动一段距离后,越拉越大,推测是android:below="@id/article_list_pic"这个属性的问题,使用LinearLayout就无此现象
更多相关文章
- Android(安卓)最强RecyclerView分割线XRecyclerViewDivider重磅
- Android数据绑定Data Binding初体验
- Android(安卓)XML解析器的问题
- android中的UI控制(二)
- [android]editText和软键盘的一些总结
- android中的UI控制(二)
- Android(安卓)自定义TextView 实现文本间距
- Android画图学习总结(四)——Animation(下)
- android菜鸟学习笔记5----第一个android程序