java - Android SeekBar 自定义矩形拇指视觉 bug

标签 java android view slider seekbar

我尝试使用可绘制的timeline_runner.png enter image description here设置自定义矩形拇指

我的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:

<?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>

在 < 21 版本中,所有版本都工作正常。

enter image description here

但是在21+时,移动拇指时会出现灰色圆圈:

enter image description here

如何删除它?

最佳答案

要禁用 SeekBar 拇指上的涟漪效果,您必须null背景,例如

android:background="@null"

关于java - Android SeekBar 自定义矩形拇指视觉 bug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33085187/

相关文章:

java - 在Java中将编码UTF-8的字符串转换为TIS620(泰语编码)。有哪些方法可以做到这一点并且不会丢失数据?

android - 如何修复AAPT:在包“android”中找不到属性“appComponentFactory”的资源标识符?

java - 如何从 Activity 中获取偏好值?

java - 如何将上下文菜单添加到表格布局?

android - 如何从 Android 中的 YouTube 视频 URL 获取观看次数?

机构的 Javadoc 标签

java - 如何故意产生ConnectException?

c# - 如何使用 MVVM 将 UserControl 从插件传递到我的主窗口?

python - 就地排序的子列表

java - 隐式 super 构造函数 Shape2D() 未定义。关于 "include Java.awts.Color"