2016-02-02 1 views
-1

У меня есть требование, где мне нужно иметь много горизонтальных RecyclerView У него будет интерфейс, похожий на Google PlayStore. Теперь проблема в том, что если я добавлю ScrollView в свой макет и запустил приложение, то он ничего не отобразит на экране. Когда я удалить его показать RecyclerViewМногие Горизонтальные RecyclerView в деятельности

Это XML

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/featured" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10sp" 
       android:background="#ECEFF1" /> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/latest" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10sp" /> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/startup" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10sp" /> 
     </LinearLayout> 
    </ScrollView> 

</LinearLayout 

Как я должен решить эту проблему. Я хочу добавить ScrollView к деятельности, которая будет иметь 9 до 10 по горизонтали RecyclerView

+0

я думаю, вы должны использовать NestedScrollView вместо Scrollview http://developer.android .com/intl/vi/reference/android/support/v4/widget/NestedScrollView.html см. http://stackoverflow.com/questions/27083091/recyclerview-inside-scrollview-is-not-working – vuhung3990

+0

Спасибо за suguestion и ссылка. –

ответ

0

Установите высоту Recyclerviews до фактического значения йра

+0

Спасибо. Это сработало! –

Смежные вопросы