Mathieu
Mathieu

Reputation: 1491

How to set up a real custom Listview?

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!

Upvotes: 2

Views: 344

Answers (2)

Paresh Mayani
Paresh Mayani

Reputation: 128448

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.

Upvotes: 2

mreichelt
mreichelt

Reputation: 12455

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: How to add multiple headers throughout a single ListView with addHeaderView()? 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.

Upvotes: 2

Related Questions