Ela*_*da2 4 java layout android android-layout
我试图在我的活动中添加评级栏
但我不能在用户的触摸上添加或删除星星.
我应该添加什么?
<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>
Run Code Online (Sandbox Code Playgroud)
Ahm*_*ck' 19
您的RatingBar样式设置为指标
style="?android:attr/ratingBarStyleIndicator"
Run Code Online (Sandbox Code Playgroud)
这会阻止用户互动,尝试android:isIndicator="false"
手动设置,如果不起作用,请尝试将其样式更改为
style="?android:attr/ratingBarStyle"
Run Code Online (Sandbox Code Playgroud)