Question

I want to have a list with radio buttons displayed when a Preference in a PreferenceActivity is selected(like when the Music preference is selected on an HTC sensation in the default gallery app-slideshow). I do not want to use fragments because the above model was running Gingerbread and doesn't support fragments. The list should also have buttons at the bottom. It's a sort of ListPreference. But, like a customized ListPreference(so that it has more than the default single button and also the list occupies the entire screen) So, how do you display a list like this?

Was it helpful?

Solution 2

Use this as the TextView for the list items:

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/radio_text_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical" 
    android:paddingLeft="3dip"
    android:checkMark="?android:attr/listChoiceIndicatorSingle"
    android:paddingRight="3dip"
    android:padding="10dip"    
    android:singleLine="true"
    android:ellipsize="marquee" /> 

OTHER TIPS

for list preferences with radio button use this

<ListPreference
    android:entries="@array/scheme_choices"
    android:entryValues="@array/scheme_values"
    android:key="scheme"
    android:title="Scheme" />

add required values in the string.xml file

<string-array name="scheme_values">
    <item>one</item>
    <item>two</item>
</string-array>

values

<string-array name="scheme_choices">
    <item>One</item>
    <item>Two</item>
</string-array>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top