安卓评分栏大小

标签 android layout

我终于找到了如何更改 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>

但是每当我更改 minHeightmaxHeight 中的大小时,它都保持不变。

我的布局 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 开始的评论。

http://code.google.com/p/android/issues/detail?id=18659

关于安卓评分栏大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355189/

相关文章:

php - 如何防止 CSS 中的 Div 换行?

java - 如何为 GridBagLayout 设置约束

android - 是否可以通过 Kotlin Android Extension 以编程方式包含特定布局?

java - Android:在 Java 代码中从 strings.xml 中获取字符串

c# - 具有测量/所需尺寸问题的 Silverlight 控件,图像从中间用户控件拉伸(stretch)

html - flex 盒子的问题

android - ScrollView 使自定义布局不可见

java - Android 汉堡/箭头图标动态改变颜色

android - 在 Android 中设置和取消设置默认应用

android - Android Lollipop 中应用程序外部配置文件和内部配置文件之间的数据传输