[英]RatingBar does not show 'numStars' stars
The activity has a RecyclerView which consists of multiple card_layouts A card_layout has a full ImageView and RatingBar. 该活动具有一个RecyclerView,其中包含多个card_layouts。card_layout具有完整的ImageView和RatingBar。
I set the 'numStars' of RatingBar to show the maximum rating score and use 'setRating' to set the actual rate within Java code. 我设置RatingBar的'numStars'以显示最高评分,并使用'setRating'设置Java代码中的实际比率。
However, the RatingBar does not have 'numStars' stars. 但是,RatingBar没有“ numStars”星。
What did I do wrong? 我做错了什么?
Here is xml code of my RatingBar 这是我的RatingBar的xml代码
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:isIndicator="true"
android:numStars="5"
android:scaleX="0.5"
android:scaleY="0.5"
android:theme="@style/RatingBar"
android:transformPivotX="8dp"
android:transformPivotY="8dp" />
I appreciate your help 我感谢您的帮助
Hi you can try numStars progrmatically using this syntax: 嗨,您可以使用以下语法以编程方式尝试numStars:
ratingbar.setNumStars(int numStars); ratingbar.setNumStars(int numStars);
You can refer to this doc for other additional info on rating bar; 您可以参考此文档以获取有关评级栏的其他附加信息;
https://developer.android.com/reference/android/widget/RatingBar https://developer.android.com/reference/android/widget/RatingBar
If still the rating (stars) still not showing or rendering , you can try these steps: 如果仍然没有显示或显示评分(星号),则可以尝试以下步骤:
hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.