简体   繁体   中英

Why size of rating bar not decreasing?

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>

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM