Android RatingBar 在某些设备上显示黑色覆盖

标签 android xml android-layout android-studio ratingbar

我在应用程序中有这个评分栏,它始终正确显示。 但最近我意识到它在某些设备上无法正常工作(包括带有 Lollipop 版本的 Nexus 5)。 评级栏被黑色覆盖层覆盖,如下图所示(仅在某些设备上)。当 ListView (带有评级星)滚动时,将显示评级栏(然后是黑色覆盖层)再次显示)。它只影响黄色的星星,不影响白色的星星。

我不确定以前是否有人遇到过这个问题?我在想是否是 Nexus 5 上最近的 android 更新导致了这一点,因为评级栏在其他设备上运行良好。

Black overlay on rating star

最佳答案

据我所知,

这可能正在使用支持库的 v21 或可能不稳定的操作系统更新,因为 .xml 文件和代码不可用。

这些是谷歌报告的评级栏问题,请查看下面的链接,

RatingBar rendering broken on devices

The development team has fixed the issue that you have reported and it will be available in a future build.

RatingBar w/ Custom Stars Drawable is rendered as 1 stretched star on pre-Lollipop phones

when using v21 of the support libraries, the RatingBar w/ custom stars renders as expected. With v22, instead of 5 stars, you just get one, but stretched to match the width that 5 stars should take

First of all, do not use RatingBar#setProgressDrawable because no matter what platform, it is going to work like #setBackground() (single stretched image for whole background). Secondly, setting android:ratingBarStyle on theme level does not work. I ended up creating custom style, with "android:progressDrawable" and applying it for every view I needed.

RatingBar does not render in InfoWindow

setting the style to android:attr/ratingBarStyle does not work, and ratingBarStyleSmall does work

关于Android RatingBar 在某些设备上显示黑色覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27477098/

相关文章:

android - phonegap 构建应用程序的 Manifest.xml 和 config.xml 之间的区别

java - 如何在Android回收器 View 项目上添加onClick事件?

android - Android 中的 anchor View

java - 如何使用 showDialog(id) 更新 AlertDialog 内容

Android Studio 将使用过的导入语句设为未使用?

android - ToneGenerator 在 android 6.0 中崩溃

xml - XLS 到 CSV 转义

java - 由于创建 bundle 失败,我无法在 Eclipse 中部署 JavaFX 项目

java - Android:扩展CardView可以扩展哪些内容

android - 在 Android 中设置背景颜色并使用 Drawable 作为背景