[英]Android Rating bar Invisible
以下是我的评分栏代码
<RatingBar
android:id="@+id/ratingBarU"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_weight="1"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
我遇到的问题是,当我将样式设置为时,
style="?android:attr/ratingBarStyleSmall"
当我尝试
style="?android:attr/ratingBarStyleIndicator"
评分栏显示所有 10 颗星,但在我的模拟器上运行时无法点击。 我想要的只是让我的评分栏显示所有 10 颗星并适合屏幕尺寸请帮助! 我对 android 开发非常陌生
想想你在LinearLayout(Horizontal)内使用。 你能在垂直线性布局中使用这个代码吗
<RatingBar
android:id="@+id/ratingBarU"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/ratingBarStyleIndicator"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
使layout_height
wrap_content不使用特定的 dp 值,我也不明白您为什么使用layout_weight
,因为您将特定高度设置为45dp
(它应该是 wrap_content)并将宽度设置为 wrap_content。 您的评分栏应如下所示
<RatingBar
android:id="@+id/ratingBarU"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="10"
android:progressTint="#FBE140"
android:stepSize="1" />
Output
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.