Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/205.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Seekbar中没有标记颜色_Android - Fatal编程技术网

Android Seekbar中没有标记颜色

Android Seekbar中没有标记颜色,android,Android,我想删除seekbar中的标记颜色(本例中为黄色) 代码: 有没有简单的方法可以做到这一点?请参阅。SeekBar源于View,您应该尝试使用xml定义中的可绘制形状(使用纯色)使用android:background修改背景,或者使用setBackgroundColor以编程方式更改颜色 要删除颜色,应尝试将其设置为纯透明颜色 我还没有测试,所以让我们知道如果失败会发生什么 更新 你可以试试: 定义一个res/drawable/white_bg.xml <shape xmlns:an

我想删除seekbar中的标记颜色(本例中为黄色)

代码:


有没有简单的方法可以做到这一点?

请参阅。SeekBar源于View,您应该尝试使用xml定义中的可绘制形状(使用纯色)使用android:background修改背景,或者使用setBackgroundColor以编程方式更改颜色

要删除颜色,应尝试将其设置为纯透明颜色

我还没有测试,所以让我们知道如果失败会发生什么

更新

你可以试试:

定义一个
res/drawable/white_bg.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <solid android:color="@android:color/white" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:id="@android:id/background">
    <shape>
      <corners android:radius="5dip" />
      <gradient
          android:startColor="#ff9d9e9d"
          android:centerColor="#ff5a5d5a"
          android:centerY="0.75"
          android:endColor="#ff747674"
          android:angle="270"/>
    </shape>
  </item>

  <item android:id="@android:id/progress">
    <clip>
      <shape>
        <corners android:radius="5dip" />
        <solid android:color="@android:color/transparent" />
      </shape>
    </clip>
  </item>

</layer-list>
类似于
platforms/android-8/data/res/drawable/progress\u horizontal.xml
文件(android-8就是一个例子),并为seekbar xml定义定义
android:progressDrawable=“@drawable/seekbar\u bg”
属性

我假设不需要在SeekBar的中定义
@android:id/secondaryProgress
项,但应该对其进行验证

您还可以根据
platforms/android-8/data/res/drawable/seek_thumb.xml
声明一个本地选择器来重新定义

有趣的是,自从我从未使用过SeekBar以来,我从这本书中学到了很多,谢谢!)

对于尝试/错误方法和多次更新,我深表歉意…

请参阅。SeekBar源于View,您应该尝试使用xml定义中的可绘制形状(使用纯色)使用android:background修改背景,或者使用setBackgroundColor以编程方式更改颜色

要删除颜色,应尝试将其设置为纯透明颜色

我还没有测试,所以让我们知道如果失败会发生什么

更新

你可以试试:

定义一个
res/drawable/white_bg.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <solid android:color="@android:color/white" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:id="@android:id/background">
    <shape>
      <corners android:radius="5dip" />
      <gradient
          android:startColor="#ff9d9e9d"
          android:centerColor="#ff5a5d5a"
          android:centerY="0.75"
          android:endColor="#ff747674"
          android:angle="270"/>
    </shape>
  </item>

  <item android:id="@android:id/progress">
    <clip>
      <shape>
        <corners android:radius="5dip" />
        <solid android:color="@android:color/transparent" />
      </shape>
    </clip>
  </item>

</layer-list>
类似于
platforms/android-8/data/res/drawable/progress\u horizontal.xml
文件(android-8就是一个例子),并为seekbar xml定义定义
android:progressDrawable=“@drawable/seekbar\u bg”
属性

我假设不需要在SeekBar的中定义
@android:id/secondaryProgress
项,但应该对其进行验证

您还可以根据
platforms/android-8/data/res/drawable/seek_thumb.xml
声明一个本地选择器来重新定义

有趣的是,自从我从未使用过SeekBar以来,我从这本书中学到了很多,谢谢!)


对于尝试/错误方法和多次更新,我深表歉意…

我尝试了sb.setBackgroundColor(Color.TRANSPARENT);-->没有什么changed@test123123好的,这并不是那么简单,但我编辑了我的答案,它起作用了,我让你自己重新定义拇指符号,如果需要的话…我尝试了sb.setBackgroundColor(Color.TRANSPARENT);-->没有什么changed@test123123好吧,这不是那么简单,但我编辑了我的答案,它工作了,我让你自己重新定义拇指符号,如果需要的话…我的答案有帮助吗?有精确性吗?我的回答有用吗?精确吗?