2016-11-15 11 views
0

NestedScrollViewを使用してRecyclerViewを作成しようとしていますが、RecyclerViewは表示されません。入れ子のRecyclerViewは表示されません

これは私のXMLレイアウトです:

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.yarkoni.anybody.activities.OffersActivity" 
    tools:showIn="@layout/activity_offers"> 

    <!-- A RecyclerView with some commonly used attributes --> 
    <android.support.v7.widget.RecyclerView 
     android:id="@+id/offerContent_recyclerView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@android:color/holo_red_dark" 
     android:scrollbars="vertical" /> 
</android.support.v4.widget.NestedScrollView> 

は、これが私の活動です:

final LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); 
layoutManager.setAutoMeasureEnabled(false); 
offersRecyclerView.setLayoutManager(layoutManager); 

ArrayList<Offer> offerList = new ArrayList<>(); 
offerList.add(new Offer("Lorem")); 
offerList.add(new Offer("Lorem")); 
OffersAdapter offersAdapter = new OffersAdapter(offerList); 
offersRecyclerView.setAdapter(offersAdapter); 
offersRecyclerView.setNestedScrollingEnabled(false); 
+0

このような問題をデバッグする最善の方法は、最初にRecyclerViewに固定された高さを割り当て、最初に正しく表示されていることを確認することです。また、ScrollView内にMatch/Match RecyclerViewがあるのはなぜか不思議ですが、その1つが無関係なようです。 – wblaschko

答えて

0

recyclerview固定の高さを与えることによって、試してみてください。

関連する問題