android - 按住时带有粉红色背景的 RatingBar
问题描述
但是当触摸(并握住)它们时,所有未评级的星星都是粉红色的,就像这样
为什么会这样?
xml:
<RatingBar
android:id="@+id/ratingBarSchedulesRatingTour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:numStars="5"
android:progressTint="@color/yellow_star"
android:secondaryProgressTint="@color/yellow_star"
android:stepSize="1" />
@color/yellow_star 在 colors.xml 中作为 #F1CD1E
解决方案
创建您想要的样式和颜色(按/正常)
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">#F1CD1E</item>
<item name="colorControlActivated">#F1CD1E</item>
</style>
<RatingBar
android:id="@+id/ratingBarSchedulesRatingTour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:numStars="5"
android:progressTint="#F1CD1E"
android:theme="@style/RatingBar"
android:secondaryProgressTint="#F1CD1E"
android:stepSize="1" />
推荐阅读
- java - 如何使用(对象引用或对象类型)作为 Hashmap 中的值?
- pip - awsebcli NameError 的 pip 安装突然失败:未定义名称“平台系统”
- python - 使用 pip 安装 cdqa 时如何修复错误“Command errored out with exit status 1”?
- apache-flink - Flink TaskManager livenessProbe 不起作用
- android - Android:将应用程序发布到 Playstore 后,OTP 自动读取功能不起作用
- javascript - 如果密钥已经存在于firebase上,如何防止collection()设置
- objective-c - st_flags 位说明
- kubernetes - 安装 Jupyterhub hub pod 失败,没有可用的卷区域
- github - 当 Github 存储库位于给定用户的帐户中时,这意味着什么?
- google-apps-script - 将特定单元格中的数据复制到不同文件夹中具有不同格式的不同工作表中