[英]Strange custom SeekBar drawable behavior on different APIs
在運行 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" />
由於未知的原因,通過玩 minHeight 和 maxHeight 我能夠獲得所需的行為
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.