简体   繁体   English

Android SeekBar自定义矩形拇指视觉错误

[英]Android SeekBar custom rectangle thumb visual bug

I try to set custom rectangle thumb with drawable timeline_runner.png 我尝试使用可绘制的timeline_runner.png设置自定义矩形拇指 在此处输入图片说明

SeekBar in my activity.xml: 我的activity.xml中的SeekBar:

<SeekBar
    android:id="@+id/seekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxHeight="10dp"
    android:minHeight="10dp"
    android:progressDrawable="@drawable/seek_bar_video"
    android:thumb="@drawable/timeline_runner"
    android:thumbOffset="0dp"
    android:padding="0dp"
    android:layout_weight="1"
    android:layout_marginLeft="17dp"
    android:layout_marginRight="12dp"/>

seek_bar_video.xml: seek_bar_video.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/timeline_grey"
      android:height="10dp"
      android:gravity ="center"
    />
    <item android:id="@android:id/progress">
       <scale
           android:drawable="@drawable/timeline_yellow"
           android:scaleWidth="100%"
           android:height="10dp" />
    </item>
 </layer-list>

At versions < 21 all are working fine. 在版本小于21时,一切正常。

在此处输入图片说明

But at 21+ when moving thumb appears grey circle: 但是在21+时,移动拇指会出现灰色圆圈:

在此处输入图片说明

How can I remove it? 如何删除?

要禁用SeekBar拇指上的波纹效果,您必须将背景设为null ,例如

android:background="@null"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM