【问题标题】:Seek Bar thumb not transparent in Android 5.0 API 21 Lollipop在 Android 5.0 API 21 Lollipop 中,Seek Bar thumb 不透明
【发布时间】:2015-02-09 12:39:50
【问题描述】:

API 级别

Thumb 是透明的,正如预期的那样。

API 级别 21

拇指不透明,不知道为什么。

这里是代码

 <SeekBar
                android:id="@+id/ui_audioplayer_progressbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:progressDrawable="@drawable/custom_progress_bar_horizontal"
                android:thumb="@drawable/stud_slider" />

有趣的是,当您更改 API 级别透视图时,可以在 eclipse 本身的 xml 预览中看到并重现此问题。

注意:

  • 我在两台设备上运行相同的 apk。
  • 这两款设备的品牌和型号相同,即 Nexus 5。
  • 拇指图像是具有透明背景的 PNG,从 API 级别

这是 Lollipop 中的已知错误还是我做错了什么?

【问题讨论】:

  • @alanv 这是同一个问题。感谢您指出。但是问题标题描述性不够。不编辑该问题,并将其保留在这里,以便人们可以通过任一查询搜索答案。

标签: android transparency android-5.0-lollipop


【解决方案1】:
<SeekBar
    ....
    android:splitTrack="false" 
/>

【讨论】:

  • 你是救生员 :)
  • 当我在我的 SeekBar 中使用属性 android:splitTrack = "false" 时,我收到一个错误,“在包 'android' 中找不到属性 'splitTrack' 的资源标识符”。请帮帮我。
  • 哦,明白了:)。当我将目标 API 级别设置为 21 时,问题解决了。
  • 你是怎么知道的?
【解决方案2】:

对于所有 API 级别,

<Seekbar
    .....
    android:background="@null"
    android:splitTrack="false"
    ....
 />

会起作用。它对我有用。

【讨论】:

  • 拯救了我的一天 +1,还使用了在 imageview 上实现的 android drawable,因此将 imageview 背景设置为 @null
猜你喜欢
  • 2023-03-20
  • 1970-01-01
  • 2019-07-27
  • 1970-01-01
  • 2015-01-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多