Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Androidx SeekBarPreference xml attribute setMax not found

I'm trying to implement androidx SeekBarPreference, according to the docs I might be able to use setMax attribute in my xml, yet I get the following error when doing so:

in xml:

<SeekBarPreference
    app:key="preference_key"
    app:title="@string/preference"
    app:showSeekBarValue="true"
    app:setMax="10"/>

the error:

root_preferences.xml:53: AAPT: error: attribute setMax (aka 
gls.dev.MyApplication:setMax) not found.

However, when setting the properties in code it works like a charm:

findPreference<SeekBarPreference>("preference_key")?.apply {
    max = 10
    min = 1
    seekBarIncrement = 1
    isAdjustable = true
}
like image 760
glisu Avatar asked Oct 25 '25 15:10

glisu


1 Answers

The max attribute currently only exists in the android: namespace, so you will need to use:

<SeekBarPreference
    app:key="preference_key"
    app:title="@string/preference"
    app:showSeekBarValue="true"
    android:max="10"/>
like image 163
Louis Avatar answered Oct 27 '25 06:10

Louis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!