2015-12-14 62 views
0

我希望能夠在其Play商店應用中獲得與Google相同的結果。獲得類似Google Play商店「列表內列表」的結果

enter image description here

我能想到的唯一的辦法是增加一個Recyclerview在Recyclerview適配器像下面。

<android.support.v4.widget.SwipeRefreshLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

內部視圖

<android.support.v7.widget.CardView 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:elevation="100dp" 
card_view:cardCornerRadius="8dp"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="8dp" 
    android:orientation="vertical"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="8dp"/> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recyclerView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 
    </android.support.v7.widget.RecyclerView> 
</LinearLayout> 

問題是內部Recyclerview將無法正確顯示。

enter image description here

你知道如何使它顯示其內容或你有任何想法如何實現它的另一種方式?

感謝

回答

0

我不認爲谷歌內部使用另一個列表清單:內一個不可滾動,所以如果需要......他們只是建立多行的單元格(即,如果該數據包含多個付款方法)在回收站適配器中。

您實際上可以看到「更多付款設置」,所以我猜這張卡有最大數量的付款方式可供顯示。

+0

看來他們確實如此。我只是在屏幕截圖上刪除了我的信用卡號碼,但他們在「添加付款方式」元素上方一個接一個地添加了所有付款方式。 –

+0

這並不意味着他們使用了一個listview。再次沒有涉及滾動 –

+0

我明白,但他們如何實現呢?在LinearLayout中手動添加視圖?動畫對我來說真的看起來像一個回收視圖動畫。如果你想看,你可以自己檢查一下。 –