[英]Strange custom SeekBar drawable behavior on different APIs
On devices running Android API <= 22, my custom SeekBar looks as follows:在运行 Android API <= 22 的设备上,我的自定义 SeekBar 如下所示:
On devices running Android API >= 23, my custom SeekBar looks as follows:在运行 Android API >= 23 的设备上,我的自定义 SeekBar 如下所示:
Why does my SeekBar drawable look incorrect on devices API >= 23?为什么我的 SeekBar drawable 在设备 API >= 23 上看起来不正确? Here is my XML
这是我的 XML
seekbar_progress.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 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>
layout file布局文件
<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" />
由于未知的原因,通过玩 minHeight 和 maxHeight 我能够获得所需的行为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.