sou*_*lah 10 xml android ratingbar
当用户点击它时,ratingbar没有改变?
她是我的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>
Run Code Online (Sandbox Code Playgroud)
当在android jellybean api level 17上测试使用ratingBarStyleSmall时,问题就出现了
pou*_*uya 14
所以我有同样的问题,我把android:isIndicator="false"我的RatingBar标签,它解决了我的问题,现在我的全速率条标签看起来像这样:
<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"/>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.有关更多信息,您也可以参考这个答案.
注意:
1.评级栏选择启用-android:isIndicator="false"
2.星级数量-android:max="5"
3.将星级选择增加 1 -android:stepSize="1"
4.这很重要-android:layout_width="wrap_content"
5.将评级栏水平居中对齐-android:layout_gravity="center_horizontal"
<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" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7897 次 |
| 最近记录: |