views:

106

answers:

2

Hello everyone,

In my app, I should set up a "real" custom listview. For example :


First line(Some Text) Checkbox

Second line(Some Text) Spinner


What I mean is that each line has different widget. In the example, for the first line, we have a checkbox, for the second, it is a Spinner.

Does someone have any idea of how I can set it up?

Thanks a lot!

+1  A: 

Do you really think you need a ListView? Or could a ScrollView fix your problem already? If you definitely need a ListView, read my answer here: http://stackoverflow.com/questions/3730358/how-to-use-android-addheaderview/3765054#3765054 You can define different types for your items and return a different layout for each type, while still having the possibility to get higher performance by using convertView.

mreichelt
And if it absolutely must be a ListView, check out Commonsware's SackOfViewsAdapter (http://github.com/commonsguy/cwac-sacklist)
benvd
+1  A: 

Check out an example given on this page for defining custom-listview: http://www.androidpeople.com/android-custom-listview-tutorial-example/

Same way, you can define your custom-layout for listview, you just need to implement getView method.

PM - Paresh Mayani