評価バーがユーザーがクリックしたときに変更されませんでしたか?ratingBarStyleSmallスタイルを使用しているときに、評価バーが機能しない(クリック不可)
彼女はそれがRatingBarの振る舞いを定義している17
評価バーがユーザーがクリックしたときに変更されませんでしたか?ratingBarStyleSmallスタイルを使用しているときに、評価バーが機能しない(クリック不可)
彼女はそれがRatingBarの振る舞いを定義している17
アンドロイドjellybean APIレベルでテストratingBarStyleSmall を使用した場合
<?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>
問題だけで発生し、私のXMLコードです。 official documentationによると、 "小さいRatingBarスタイル(ratingBarStyleSmall)と大きなインジケータのみのスタイル(ratingBarStyleIndicator)はユーザー対話をサポートしないため、インジケータとしてのみ使用する必要があります。
by this line style = "?android:attr/ratingBarStyleSmall"あなたの評価バーは機能しません。これを取り除くと機能します。
正しく動作例とスタイル= "アンドロイド?:attrの/ ratingBarStyle" を除去する必要はありませんを...
<RatingBar
style="?android:attr/ratingBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:isIndicator="false"
android:numStars="5"
android:stepSize="0.5" />
注:
1. RatingBar選択有効 - android:isIndicator="false"
2. N 。android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:stepSize="1"
android:max="5"
<RatingBar
android:id="@+id/ratingBarOutlet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="false"
style="?android:attr/ratingBarStyle"
android:max="5"
android:layout_gravity="center_horizontal"
android:stepSize="1" />
私は同じ問題を抱えていました。私はandroid:isIndicator="false"
を私のRatingBarタグに付けました。私のために問題をolved今、私のフルレートバータグは次のようになります。
<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"/>
は、このことができます願っています。 詳細についてはthis answerも参照してください。