繁体   English   中英

RecyclerView填充在nestedscrollview下不起作用

[英]RecyclerView padding doesn't work under nestedscrollview

我需要制作一个recyclelerview,它位于一个连接到协调器内的appbarlayout的cardview内。

我有以下heirachy设置

Coordinator 
  AppBar
  NestedScrollView
    CardView
      Recycler

我无法在卡片视图中附加填充。 上边距不起作用。

 <android.support.v4.widget.NestedScrollView
    android:id="@+id/nested_scroller"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <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="match_parent"
        android:layout_marginTop="10dp"
        app:cardCornerRadius="4dp"
        app:cardElevation="@dimen/elevation_small">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/establishments_rv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
    </android.support.v7.widget.CardView>

</android.support.v4.widget.NestedScrollView>

cardview中的margintop参数不会产生任何影响。

有什么指针吗?

尝试将android:paddingTop =“10dp”添加NestedScrollView

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM