问题
I'm trying to customize my seekbar like this:
On API level < 23, progress line is visible even if progress of seekbar equals to 0. But on API level = 23, I have strange issue: progress line not showing in the same conditions =/ I want to see this line, because it is clarifying borders of usage my seekbar.
My seek_bar_progress_bar.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/seek_bar_track" />
<item android:id="@android:id/secondaryProgress">
<scale
android:drawable="@drawable/seek_bar_track"
android:scaleWidth="100%" />
</item>
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/seek_bar_track"
android:scaleWidth="100%" />
</item>
</layer-list>
My style.xml
:
<style name="seek_bar_style" parent="android:Widget.Holo.Light.SeekBar">
<item name="android:progressDrawable">@drawable/seek_bar_progress_bar</item>
<item name="android:indeterminateDrawable">@drawable/seek_bar_progress_bar</item>
<item name="android:thumb">@drawable/seek_bar_thumb_selector</item>
</style>
Thanks in advance!
回答1:
Well, I really don't know, why my progress bar line not shows on Android 6 devices, if my drawables for seek_bar_track was simple .png images. But when I changed this format into .9.png (with SDK tool draw9patch) - it works.
Summary - I transformed my .png images for seek_bar_track to .9.png format, and it helped me into solve my problem.
来源:https://stackoverflow.com/questions/35273071/android-marshmallow-custom-seekbar-progress-bar-not-showing