kiki
kiki

Reputation: 13987

Android: How to work with Checked ListViews

I wish to work with checked list views wherein only one item can be selected at a time. Some queries related to this:

  1. Is it advised to work with CheckedTextView as the ListView items, or a combination of CheckBox and TextView?

  2. If using CheckedTextView, the text comes first and the checkbox appears on the right edge. Is it possible to make the checkbox appear on the left of the TextView?

  3. How can I make one of the items as checked in onCreate()?

Note: I am using array adapter and calling setAdapter() to populate list.

Upvotes: 0

Views: 575

Answers (1)

Zelimir
Zelimir

Reputation: 11028

You need to extend ArrayAdapter and use LayoutInflater to inflate the row layout as you need. This way you have full flexibility in list creation.

Please check this example, where basic idea is described:

Custom list view

Upvotes: 1

Related Questions