Android 回收器视图在视图之间填充无效
我试图在回收器视图中的每个视图之间添加一个填充。但它不起作用 Xml代码:Android 回收器视图在视图之间填充无效,android,android-recyclerview,Android,Android Recyclerview,我试图在回收器视图中的每个视图之间添加一个填充。但它不起作用 Xml代码: <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view_schedule" android:layout_width="match_parent" android:layout_height="wrap_content" android:padd
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view_schedule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3"
tools:itemCount="2"
tools:listitem="@layout/layout_schedule">
</android.support.v7.widget.RecyclerView>
感谢您的帮助它按设计工作。您的代码将8dp填充应用于回收器视图,而不是其子视图。你应该在你的
计划表上加上边距,以实现你的目标
或者,如果您使用CardView作为项目视图的容器,则可以将其app:cardUseCompatPadding
属性设置为true
,并且它也将获得一个间距
<android.support.v7.widget.CardView 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"
app:cardUseCompatPadding="true">
...................
your item layout structure
...................
</android.support.v7.widget.CardView>
...................
您的项目布局结构
...................
什么不起作用?你尝试了什么?我的回收器视图中的LY2卡视图之间的填充。我想在他们之间留个空间。我现在正在做一个android 3的roolback。0@GuillaumeEbert很高兴听到这个消息。如果有帮助的话,你可以把这个答案标记为正确的。Kyrycuck完成了!
<android.support.v7.widget.CardView 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"
app:cardUseCompatPadding="true">
...................
your item layout structure
...................
</android.support.v7.widget.CardView>