2017-04-12 89 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

相關問題