【发布时间】:2017-08-01 19:59:00
【问题描述】:
我在我的代码中添加了一个 RatingBar,它运行良好,除了一件事。我正在尝试将步长设置为 0.1,但它仍然根据默认的 0.5 步长做出反应。我可以轻松地将步长设置为高于 0.5,它会按预期做出反应,但不会更低。
我不知道为什么?我唯一能想到的是 RatingBar 的步长上限为 0.5?对于 RatingBar 最少抽取半颗星,哪一个没有意义?
<android.support.v7.widget.AppCompatRatingBar
android:theme="@style/RatingBar"
android:stepSize="0.1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingbar"
android:numStars="5"
android:rating="0.1"
style="?android:attr/ratingBarStyleSmall"
android:layout_below="@+id/title"
android:layout_centerHorizontal="true" />
上面的代码会显示半颗星。但据我所知,它应该是画了十分之一的星星。
P.S 我尝试以编程方式实现它,但仍然相同。
【问题讨论】: