我正在尝试像标记的那样设置搜索栏/滑块的样式离散滑块 - 单击(有小刻度线指示器)材料设计指南 https://www.google.com/design/spec/components/sliders.html#sliders-continuous-slider。我无法弄清楚显示刻度线的神奇咒语,有人知道该怎么做吗?
我的搜索栏有 5 个位置 (0-4)
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="4" />
使用 style 属性添加刻度线:
<SeekBar
android:id="@+id/seekBar"
style="@style/Widget.AppCompat.SeekBar.Discrete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="10"
/>
或者通过设置tickMark可绘制来手动添加它们:
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="10"
android:tickMark="@drawable/tickmark"
/>
刻度线.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="4dp"
android:height="4dp"/>
<solid android:color="@android:color/white"/>
</shape>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)