如何减小Ratingbar的大小?

赫萨姆

在我的活动中,我有一些评分栏。但是这个酒吧的大小太大了!如何缩小尺寸?

编辑

感谢Gabriel Negut,我使用以下样式进行了此操作:

<RatingBar
style = "?android:attr/ratingBarStyleSmall"
android:numStars = "5"
android:rating   = "4" />

现在,尺寸减小了,但是星级数和等级不生效!!!为什么?我有7颗星被选中其中6颗。

加布里埃尔·内古特(Gabriel Negut)

我发布的原始链接现在已断开(有充分的理由说明仅发布链接不是最佳方法)。您必须RatingBar使用ratingBarStyleSmall或自继承的自定义样式设置样式Widget.Material.RatingBar.Small(假设您在应用中使用Material Design)。

选项1:

<RatingBar
    android:id="@+id/ratingBar"
    style="?android:attr/ratingBarStyleSmall"
    ... />

选项2:

// styles.xml
<style name="customRatingBar"   
    parent="android:style/Widget.Material.RatingBar.Small">
    ... // Additional customizations
</style>

// layout.xml
<RatingBar
    android:id="@+id/ratingBar"
    style="@style/customRatingBar"
    ... />

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章