0

Is it possible to populate a the same listview with 4 different sources?

at the moment my design is a textview listview textview listview

what i dont like is the two listview scroll indepently so if the top one is almost empty i have alot of empty space on my screen, if I dont set the top one to a fixed size and it is very full, the bottom one is not shown.

I would like to have one listview/scrollview so everything is arranged nicely indepent on how many entries are in either of the arrays i use to populate my listviews.

can that be done? thanks

this is my xml as mention above

 <TextView
    android:id="@+id/gamesView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/top_btns"
    android:gravity="center"
    android:text="@string/gamesView"
    android:textColor="#FFFFFF"/>

<ListView
    android:id="@+id/gameslist"
    android:layout_width="match_parent"
    android:layout_height="260dip"
    android:layout_below="@id/gamesView" />

<TextView
    android:id="@+id/finishedGamesView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/gameslist"
    android:gravity="center"
    android:text="@string/endedGamesView"
    android:textColor="#FFFFFF"/>

<ListView
    android:id="@+id/finishedgameslist"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/finishedGamesView" />
rasmus
  • 125
  • 2
  • 3
  • 11
  • How does cell looks for both of these lists? If they are pretty same you should just create and common object for them and populate it from your sources and use it in one ListView – NinjaCoder Feb 12 '15 at 19:07
  • the cells are almost the same, but I would like to also have the to textviews int there as they serve as a header to each "section" – rasmus Feb 12 '15 at 19:09
  • For headers you can just create getItemViewType and getViewTypeCount in Adapter. Refer this http://stackoverflow.com/a/13634801/569346 – NinjaCoder Feb 12 '15 at 19:10

0 Answers0