user4591396
user4591396

Reputation:

How to add radio group button in preference xml in android in one row?

I'm trying from this xml and want to add radio button but not getting solution . Here i am not getting proper solution .so suggest me . Here also attach image which type UI iwant from using Preference screen.

    <Preference

        android:key="@string/pref_key_passcode_toggle"
        android:persistent="false"
        android:widgetLayout="@layout/check_custom"
        android:title="@string/passcode_turn_on" />

    <Preference
        android:minHeight="10dp"
        android:key="@string/pref_key_change_passcode"
        android:persistent="false"
        android:title="@string/passcode_change_passcode"

        />
    <Preference
        android:height="40dp"
        android:key="@string/pref_key_change_password"
        android:persistent="false"
        android:title="@string/password_change"
        />

</PreferenceCategory>

I want to get this image type UI using only preference xml .

Upvotes: 2

Views: 1315

Answers (1)

Trevor Carothers
Trevor Carothers

Reputation: 2260

All EXISTING preferences can be found here. If you're not too picky on showing all the options at all times, you can use ListPreference. It will only show the currently selected option in the layout. When the user selects it, a dialog will be shown displaying the list of all options to choose from.

If you truly want it to look like the image above, you'll need to extends Preference and implement your own MultiSelectPreference. You can specify your own layout and use standard widgets to design it exactly how you want it to look.

Upvotes: 1

Related Questions