[英]Rating bar with custom size
I have to display rating bar with my custom size.我必须用我的自定义尺寸显示评级栏。 But in the case that rating bar with my custom size, the stars disappear in my layout.但是在我自定义大小的评级栏的情况下,星星在我的布局中消失了。 Can I manage the size of padding and margin the rating bar?我可以管理填充的大小和评分栏的边距吗?
<RatingBar
android:focusable="false"
android:id="@+id/rating_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:numStars="5"
android:stepSize="1.0"
android:scaleX="0.3"
android:scaleY="0.3" />
You can try to set the parameters from styles:您可以尝试从样式设置参数:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomRatingBar" parent="@android:style/Widget.RatingBar" >
<item name="android:numStars">5</item>
<item name="android:stepSize">1.0</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingBottom">44dp</item>
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginTop">4dp</item>
</style>
<resources />
And then in your RatingBar
add a style:然后在您的RatingBar
添加样式:
style="@style/CustomRatingBar"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.