2016-06-27 2 views
0

Мой существующий код:Android Ресайклер Просмотр не отображается полная высота

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/scrollmain"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:paddingTop="24dp"> 

      <android.support.v4.widget.NestedScrollView 
       android:layout_width="match_parent" 
       android:layout_height="100dp" 
       android:fillViewport="true" 
       android:paddingBottom="4dp" 
       android:layout_below="@+id/HAT0" 
       android:id="@+id/HAT1" 
       android:paddingTop="4dp"> 

       -----Text View ------ 

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

      <android.support.v4.widget.NestedScrollView 
       android:layout_width="match_parent" 
       android:layout_height="100dp" 
       android:clipToPadding="false" 
       android:fillViewport="true" 
       android:overScrollMode="never" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior" 
       android:paddingBottom="4dp" 
       android:paddingTop="4dp" 
       android:id="@+id/HAT2" 
       android:layout_below="@+id/HAT1" 
       android:scrollbars="horizontal"> 

       ----- Text View --------- 

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

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/list" 
       android:layout_below="@+id/HAT2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:minHeight="200dp" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

     </RelativeLayout> 

    </ScrollView> 

</RelativeLayout> 

Использование этого кода RecyclerView не покрывает всю нижнюю layout.If я не говоря уже о какой-либо минимальной высоты, то я не могу видеть RecyclerView. Поэтому мне нужно указать высоту до RecyclerView. Итак, что мне делать, чтобы справиться с этой проблемой.

ответ

1

Если вы добавите атрибут android:fillViewport="true" к вашему ScrollView и установите android:layout_height="match_parent" для вашего RecyclerView, вы поправите вашу проблему.

Как что:

<ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true" 
     android:id="@+id/scrollmain"> 

<android.support.v7.widget.RecyclerView 
     android:id="@+id/list" 
     android:layout_below="@+id/HAT2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:minHeight="200dp" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" />