0

I want to create a layout file. In that i want two ListView ,and both ListView with multipleselection. ListView data i am populating from database. How to design this layout. can anyone please help me.

ananya
  • 1,001
  • 6
  • 33
  • 50

1 Answers1

0
  1. The root View of each item you will display in list must implement Checkable. When implementing this interface also update the drawable state of View. See this answer for how to do that.
  2. Set a drawable as background for this root View. Which different color/drawables for checked state and normal states.
  3. Set ListView's choice mode to single choice or multi-choice.
  4. In list adapter, provide item views with above created View as parent layout.

Now, ListView will take care of setting checked/unchecked state on its item views. Also you can call getCheckedItemIds() or getCheckedItemPositions() on ListView to get currently selected items.

You can also check a Scrollview example here

Panayiotis Georgiou
  • 1,135
  • 3
  • 19
  • 36
  • I want to design that layout file.I mean to say two Listview in one layout and both Listview data are populating from database.So how i should design this so that it will looks good. – ananya May 03 '16 at 18:26