kingston
kingston

Reputation: 11419

Inlined ListPreference in android settings

If I add a ListPreference in my settings.xml the framework shows a list-entry that when clicked shows a list of options. Is it possible to show the list "inline" I mean without making the user having to click on the entry to see the list?

What I need is to show the current selected option and then when the user clicks on it, hte list of all the available options to allow the user to pick another one.

I found this example but I wonder how my HTC can show a combo in the Accessibility settings (for "Touch & hold delay").

Upvotes: 1

Views: 948

Answers (3)

curioustechizen
curioustechizen

Reputation: 10672

You need to subclass Preference and make it behave like a Spinner or a ListView. Either that, or you can set the android:layout attribute of the <Preference> tag in the XML to return a layout which contains a ListView. Check this question.

Upvotes: 1

stuckless
stuckless

Reputation: 6545

Check out this post How do I display the current value of an Android Preference in the Preference summary?

The bottom line is that you need to register a change listener for the preference and manually update the Summary (second line) of the ListPreference using the selected value from the List. The link provides all the information and samples on how do it.

Also, Some people report that using android:summary="%s" works, but I've never gotten that to work in 2.x.

Upvotes: 0

Ron
Ron

Reputation: 24235

Use Spinner widget. Check documentation here.

Upvotes: 0

Related Questions