2017-02-28 66 views
0

我試圖做一個RecyclerView如下所示Sections分區域RecyclerView在mvvmcross安卓

我使用mvvmcross和XML我到目前爲止是這樣的:

<MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView 
    android:id="@+id/recyclerView" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    fab:MvxBind="ItemsSource EmballageGroups" 
    fab:MvxTemplateSelector="Hocras.OnRoute.Droid.TypeTemplateSelector,Hocras.OnRoute.Droid" /> 

但是,這是一個沒有章節的簡單列表。我如何在那裏得到部分? (它有每個產品類型被剖開)

+0

手段是否要擴大各部分自身,或者你想顯示哈達爾每個部分。 –

+0

@Chetan首先,我需要創建一個部分,然後我需要一個包含項目的每個部分的標題! –

+0

你知道Expandable ListView嗎? –

回答

1

看一看這裏的樣品https://github.com/MvvmCross/MvvmCross-Samples/tree/master/WorkingWithCollections

它使用MvxExpandableListView

<Mvx.MvxExpandableListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    local:MvxItemTemplate="@layout/listitem_kitten" 
    local:MvxGroupItemTemplate="@layout/listitem_expandablegroup" 
    local:MvxBind="ItemsSource KittenGroups" /> 
+0

我做的模板選擇器會工作嗎?因爲我需要每組不同的項目佈局。 –

1

的Android ExpandableListView是示出了在垂直滾動兩項目的視圖級別列表。它與ListView不同,允許兩個級別,這些級別可以輕鬆地通過觸摸查看以及各自的子項目進行展開和摺疊。 Android中的ExpandableListViewAdapter將數據加載到與此視圖關聯的項目中。

下面是由這個類使用的一些重要的方法: 請找到完整的資料到下面鏈接

Android ExpandableListView