【发布时间】:2016-05-15 07:09:04
【问题描述】:
我正在尝试为我的 android 应用程序制作自定义 RatingBar,我可以在其中更改 RatingBar 的默认大小和颜色。为此,我为 CustomRatingBar 编写了如下样式:
<style name="CustomRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/custom_ratingbar</item>
<item name="android:minHeight">25dp</item>
<item name="android:maxHeight">25dp</item>
</style>
可绘制文件为:custom_ratingbar.xml、custom_ratingbar_empty、custom_ratingbar_filled
在我的 xml 中,RatingBar 如下所示:
<RatingBar
android:id="@+id/RatingBar"
style="@style/CustomRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:isIndicator="true"
android:numStars="5" />
如何在不缩小评分栏的情况下更改星级?
【问题讨论】:
-
使用:
style="?android:attr/ratingBarStyleSmall" -
您使用的图标大小是多少?使用更大的图标,如 48x48 或 50x50 并保存在 xxhdpi 文件夹中。
标签: android xml android-layout android-studio ratingbar