评级栏在用户单击时没有改变吗?
她是我的xml代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.soulhis.testmaterialdesign.Test">
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingBar4"
android:layout_centerVertical="true"
style="?android:attr/ratingBarStyleSmall"
android:layout_centerHorizontal="true" />
</RelativeLayout>
仅在使用ratingBarStyleSmall时出现问题在android jellybean api级别17上测试]
评级栏在用户单击时没有改变吗?她是我的xml代码
所以我遇到了同样的问题,我在我的RatingBar标签上放了android:isIndicator="false"
,现在我的全费率标签看起来像这样:它为我解决了这个问题:
<RatingBar
android:id="@+id/ratingReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:numStars="5"
android:isIndicator="false"
style="@style/Base.Widget.AppCompat.RatingBar"/>
这是RatingBar的定义行为。根据official documentation,“ 较小的RatingBar样式(ratingBarStyleSmall)和较大的仅指示符样式(ratingBarStyleIndicator)不支持用户交互,应仅用作指示符。“
只需添加
正常工作的示例,无需删除style =“?android:attr / ratingBarStyle”
通过此行样式=“?android:attr / ratingBarStyleSmall”您的评级栏不起作用。删除它会起作用。
注:
android:isIndicator =“ false”
正在工作