[英]Android RatingBar shows less stars
I am trying to show a rating bar in a ListView
. 我正在尝试在ListView
显示一个评级栏。
No matter what I tried: 无论我尝试了什么:
viewHolder.viewOnlyQuickRatingBar.setNumStars(5);
or: 要么:
android:numStars="5"
or both of the above I always get the same result. 或以上两种情况,我总是得到相同的结果。 In Android 5.0 I get a 5-star rating bar and in Android 4.1.2 I get 4-star rating bar. 在Android 5.0中,我获得了5星级评分,在Android 4.1.2中,我获得了4星级评分。
The weird is when I try to show the rating bar (using the, above, xml code only) in Activity
and not in a ListView
everything is working just fine. 奇怪的是,当我尝试在Activity
而不是在ListView
显示评分栏(仅使用xml代码)时,一切正常。
How can I get a 5-star rating bar under any circumstances? 在任何情况下如何获得5星级评分?
From experience, adding : 根据经验,添加:
style="?android:attr/ratingBarStyleSmall"
in your xml can help if your view has not enough place to draw 5 stars. 如果您的视图没有足够的位置来绘制5星,则xml中的帮助会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.