我终于找到了如何更改 ratingBar 的图像,但我不知道如何更改大小。我有这个
<resources>
<style name="foodRatingBarSmall" parent="@android:style/Widget.RatingBar.Small">
<item name="android:progressDrawable">@drawable/rating_bar_used</item>
<item name="android:minHeight">10dip</item>
<item name="android:maxHeight">10dip</item>
</style>
</resources>
但是每当我更改 minHeight
和 maxHeight
中的大小时,它都保持不变。
我的布局 xml:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" android:onClick="showRecipeOnClick" android:clickable="true" style="@style/row">
<TableRow
android:id="@+id/tableRow1" android:layout_gravity="center" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center_vertical">
<TextView android:id="@+id/customName"
android:textSize="25px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="@color/black"
android:layout_weight="5">
</TextView>
<RatingBar android:id="@+id/mainRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="0.5"
android:isIndicator="true"
android:layout_gravity="center_vertical"
style="@style/foodRatingBarSmall"></RatingBar>
</TableRow>
<View android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/black"/>
</TableLayout>
我做错了什么?
谢谢你的帮助
最佳答案
改变风格
parent="@android:style/Widget.RatingBar.Small"
到
parent="@*android:style/Widget.RatingBar.Small"
有关更多信息,请参阅以下链接,尤其是从 6 开始的评论。
关于安卓评分栏大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355189/