微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android-RatingBar在不同设备上的色差

我有一个ratingBar

        <android.support.v7.widget.AppCompatratingBar
            android:id="@+id/rating"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:isIndicator="false"
            android:numStars="5"
            android:rating="0.0"
            android:stepSize="1.0"
            android:theme="@style/ratingBar"/>

和风格:

<style name="ratingBar" parent="Theme.AppCompat">
    <item name="colorControlnormal">@color/old_gray</item>
    <item name="colorControlActivated">@color/yellow</item>
</style>

问题在于这种样式由于某些原因而被忽略:

Nexus 5x API 24:

enter image description here


三星S4 API 21:

enter image description here

我的活动是FragmentActivity的扩展,也许问题在这里?怎么修?

解决方法:

从API 21开始,您只需从xml进行更改

android:progresstint="@android:color/holo_red_dark"
android:progressBackgroundTint="@android:color/holo_red_dark"
android:secondaryProgresstint="@android:color/holo_red_dark" 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。