2013-04-04 72 views
1

(使用Android版本4.0.4)Android的 - 創建像雜貨店智商列表列表

我試圖建立的功能非常相似,在GroceryIQ應用程序中發現的列表:

GroceryIQ list

我可以使用下面的xml中展示的ExpandableListView和一個擴展BaseExpandableListAdapter的自定義類來創建漂亮的列表,但我在第二個列表中遇到了問題。它是兩個列表中的一個視圖嗎?難道這只是一個特殊的列表分隔線,看起來像一個酒吧的列表?似乎有一種意見認爲

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" /> 

<ExpandableListView 
    android:id="@+id/ExpList" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:divider="@null" 
    android:dividerHeight="5dp" 
    android:groupIndicator="@null" 
    android:paddingBottom="60dp" /> 

<include 
    android:layout_width="wrap_content" 
    android:layout_alignParentBottom="true" 
    layout="@layout/bottom_bar_list" /> 

</RelativeLayout> 

我已經嘗試添加另一個列表,但兩個列表沒有合作過well--無論是第一清單砍掉或第二列表不顯示。

感謝您的想法!

回答

0

所以,我不知道可以確切知道Grocery IQ如何製作他們的列表,但我發現我可以通過超級自定義ExpandableListView來複制一個非常相似的列表。

ExpandableListView是使用自定義組項目和子項目實現的。

我在Group Item中增加了一個相對佈局,看起來像「棒棒」。然後以編程方式填充我的列表時,我有一個「流氓」Group Item,當我找到它時,我會顯示「非常棒」而不是常規組 - 在所有其他情況下,相對佈局設置爲不可見。

它需要一段時間才能讓它「恰到好處」,我的解決方案看起來有點像黑客攻擊,但這是我工作的要點。