自定义搜索栏拇指在Lollipop API21上不透明

Dam*_*dez 38 layout android android-seekbar android-5.0-lollipop

这是我的搜索:

<SeekBar
    android:id="@+id/seek1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:progressDrawable="@drawable/style_progressbar"
    android:thumb="@drawable/style_progressbar_circle"
    android:progress="20" />
Run Code Online (Sandbox Code Playgroud)

这是style_progressbar.xml:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape android:shape="rectangle" >
            <corners android:radius="5dp" />
            <gradient
                android:angle="270"
                android:endColor="@color/gris_hint"
                android:startColor="@color/gris_hint" />
        </shape>
    </item>
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape android:shape="rectangle" >
                <corners android:radius="5dp" />
                <gradient
                    android:angle="270"
                    android:endColor="@color/gris"
                    android:startColor="@color/gris" />
            </shape>
        </clip>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape android:shape="rectangle" >
                <corners android:radius="5dp" />
                <gradient
                    android:angle="270"
                    android:endColor="@color/gris"
                    android:startColor="@color/gris" />
            </shape>
        </clip>
    </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

这是style_progressbar_circle.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/red_scrubber_control_disabled_holo" android:state_enabled="false"/>
    <item android:drawable="@drawable/red_scrubber_control_pressed_holo" android:state_pressed="true"/>
    <item android:drawable="@drawable/red_scrubber_control_focused_holo" android:state_selected="true"/>
    <item android:drawable="@drawable/red_scrubber_control_normal_holo"/>
</selector>    
Run Code Online (Sandbox Code Playgroud)

这就是我在Lollipop中看到的

Seekbar Lollipop

这就是它应该如何看,这是它在Kitkat和更低版本上的外观.

Seekbar KitKat

任何的想法?我在Lollipop上遇到了一些布局问题,但这是我唯一无法解决的问题.

ala*_*anv 54

材料搜索栏默认启用拆分轨道.你需要把它关掉.

<SeekBar
    ....
    android:splitTrack="false" />
Run Code Online (Sandbox Code Playgroud)

  • 小提示.要覆盖hold thumb material效果,它足以重置背景:android:background ="@ null" (7认同)
  • 像魅力一样工作.谢谢.材质按钮默认也启用了textAllCaps,同样的问题. (2认同)