在运行Android API< = 22的设备上,我的自定义SeekBar如下所示:
在运行Android API> = 23的设备上,我的自定义SeekBar如下所示:
为什么我的SeekBar drawable在设备API> = 23上看起来不正确?这是我的XML
seekbar_progress.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/seekbar_progress_bg" />
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/seekbar_progress_fill"
android:scaleWidth="100%" />
</item>
</layer-list>
seekbar_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<size
android:width="@dimen/seekbar_thumb"
android:height="@dimen/seekbar_thumb" />
<solid android:color="@color/white" />
<stroke
android:width="@dimen/seekbar_thumb_border"
android:color="@color/gray" />
</shape>
</item>
</layer-list>
布局文件
<SeekBar
android:thumb="@drawable/seekbar_thumb"
android:progressDrawable="@drawable/seekbar_progress"
android:splitTrack="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:progress="50" />
答案 0 :(得分:1)
由于未知原因,通过玩minHeight和maxHeight,我能够获得理想的行为