Preference Example of multiple selections next to each other
I am trying to add a preference into my PreferenceScreen that allows the user to select one condition from multiple in a single row next to each other (like the image above).
Is there a pre-build way by android of doing that, or will I have to create a custom preference Layout to achieve this. An if yes what is the best way of doing that.
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:title="Preferences">
<Preference
android:key="title"
android:title="title"
android:layout="@layout/preference_title"
/>
<SwitchPreference
android:key="dark_mode"
android:title="DarkMode"
android:defaultValue="false"/>
//Instead of Switch Preference for Dark Mode
</PreferenceScreen>
There is not a pre-built preference layout like that. You need to create a custom preference just using a horizontal RadioGroup.
two_inline_button_layout.xml:
your preference xml
TwoInlineButtonPreference.kt