Why size of rating bar not decreasing?

限于喜欢 提交于 2019-12-08 12:50:17

问题


I want to decrease the size of the rating bar, but I'm unable to do so. I have tried to apply on rating bar still there is no change on rating bar size.

Please help

Here is style.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppTheme" parent="android:Theme.Light" />
    <style name="ratingBar" parent="@android:style/Widget.RatingBar">
        <item name="android:maxHeight">10dip</item>
        <item  name ="android:maxWidth">10dip</item>

    </style>

</resources>

main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >



    <RatingBar
        android:id="@+id/ratingBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="58dp"
        style="@style/ratingBar" />

</RelativeLayout>

回答1:


You need to set the drawable for the stars

 <style name="RatingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/ratingbar_stars</item>
    <item name="android:minHeight">32dp</item>
    <item name="android:maxHeight">32dp</item>
</style>

<style name="RatingBar.Small" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/ratingbar_stars_small</item>
    <item name="android:minHeight">22dp</item>
    <item name="android:maxHeight">22dp</item>
</style>


来源:https://stackoverflow.com/questions/12761998/why-size-of-rating-bar-not-decreasing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!