java – 为什么我的评级栏没有改变用户触摸?
发布时间:2020-12-15 05:17:55 所属栏目:Java 来源:网络整理
导读:我试图在我的活动中添加评级栏 但我不能在用户的触摸上添加或删除星星. 我应该添加什么? LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gr
我试图在我的活动中添加评级栏
但我不能在用户的触摸上添加或删除星星. 我应该添加什么? <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/feedback" /> </LinearLayout> <View android:layout_width="wrap_content" android:layout_height="30dp" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" > <RatingBar android:id="@+id/serviceRatingBar" style="?android:attr/ratingBarStyleIndicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" /> <TextView android:id="@+id/price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:text="@string/service" /> </RelativeLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/sendBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send" /> <Button android:id="@+id/cancelBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cancel" /> </LinearLayout> </LinearLayout> 解决方法
您的RatingBar样式设置为指标
style="?android:attr/ratingBarStyleIndicator" 这会阻止用户互动,尝试手动设置android:isIndicator =“false”,如果不起作用,请尝试将其样式更改为 style="?android:attr/ratingBarStyle" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |