【问题标题】:How to change or disable the grey highlighting around the seekbar thumb?如何更改或禁用搜索栏拇指周围的灰色突出显示?
【发布时间】:2016-11-30 15:18:45
【问题描述】:

当我在我的 Seekbar 上按下拇指时,它周围会出现一个苍白的阴影,如下所示。

如何去除阴影或将其设置为透明? 谢谢!

【问题讨论】:

  • 看看here
  • Tnx!但这对我没有帮助。
  • 我在here找到了解决方案。

标签: android seekbar seekbar-thumb


【解决方案1】:

添加

android:background="@null"

例如:

<androidx.appcompat.widget.AppCompatSeekBar
    android:id="@+id/seekbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@null" />

【讨论】:

  • 现在您已对其进行了编辑并提供了更多上下文。
【解决方案2】:

这有点不直观,但只需在 SeekBar 上设置android:background="@android:color/transparent"

【讨论】:

    【解决方案3】:

    我猜如果你改变波纹的颜色,你就可以改变那个颜色。有关如何更改按钮波纹颜色的更多信息,请参阅此link,相同的解决方案可能对您有用。

    【讨论】:

      【解决方案4】:

      colorControlHighlight控制

      所以

      
      <androidx.appcompat.widget.AppCompatSeekBar
                  android:id="@+id/seekbar"
                  android:layout_width="0dp"
                  android:layout_height="35dp"
                  android:layout_weight="1"
                  android:theme="@style/seekBarStyle"
                  />
      
          <style name="seekBarStyle">
              <item name="colorAccent">#0394D6</item>
              <item name="colorControlHighlight">#22ffffff</item>
              <item name="android:textColorSecondary">#fff</item>
          </style>
      

      好吧,'highlight'只是搜索栏的波纹背景,这很有趣!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-03-30
        • 2012-09-22
        • 2018-02-06
        • 1970-01-01
        • 1970-01-01
        • 2014-02-02
        • 1970-01-01
        • 2022-01-24
        相关资源
        最近更新 更多