我正在尝试实现具有固定值的离散滑块,但是我只能设置valueFrom,valueTo和stepSize。
这是我要执行的代码
<com.google.android.material.slider.Slider
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="8dp"
app:tickColor="@color/colorSecondaryLight"
app:tickColorActive="@color/colorSecondary" />
是否可以在滑块上设置固定值? (我将使用2、5、10、25、50和100的值)
您最好使用SeekBar
<SeekBar
android:id="@+id/sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="10"
android:thumb="@drawable/ic_location"
android:theme="@style/Widget.AppCompat.SeekBar.Discrete" />