2017-04-12 90 views
1

我需要在cardview内部创建一个与协调器内的appbarlayout连接的recyclerview。RecyclerView填充不能在嵌套滚动视图下工作

我有以下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参数没有给出任何影响。

任何指针?

回答

0

尝试增加机器人:paddingTop = “10dp”NestedScrollView

相关问题