Skip to content

SimpleListPreference

Marc Auberer edited this page Jan 17, 2021 · 4 revisions

Equivalent of the ListPreference xml tag.

Usage

In your code:

SimpleSettings(this).show {
	ListPref {
		title = "Title"
		simpleSummaryProvider = true
        entries = listOf("Apple", "Banana", "Avocado", "Pineapple")
        defaultIndex = 2
		...
	}
}

In a seperate xml file:

<PreferenceScreen
    xmlns:app="http://schemas.android.com/apk/res-auto">
	
	<ListPreference
    	app:key="key"
    	app:title="Title"
    	app:entries="@array/fruits"
        app:entryValues="@array/fruits_values"
        app:defaultValue="2"
        app:useSimpleSummaryProvider="true" 
		... />

</PreferenceScreen>