How can I decrease the size of Ratingbar?

后端 未结 16 2180
Happy的楠姐
Happy的楠姐 2020-12-12 20:08

In my activity I have some Rating bars. But the size of this bar is so big! How can I make it smaller?

Edit

Thanks to Gabriel Negut, I did

相关标签:
16条回答
  • 2020-12-12 20:35

    This was my solution after a lot of struggling to reduce the rating bar in small size without even ugly padding

     <RatingBar
            android:id="@+id/listitemrating"
            style="@android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleX=".5"
            android:scaleY=".5"
            android:transformPivotX="0dp"
            android:transformPivotY="0dp"
            android:isIndicator="true"
            android:max="5" />
    
    0 讨论(0)
  • 2020-12-12 20:41

    Using Widget.AppCompat.RatingBar, you have 2 styles to use; Indicator and Small for large and small sizes respectively. See example below.

    <RatingBar
        android:id="@+id/rating_star_value"
        style="@style/Widget.AppCompat.RatingBar.Small"
        ... />
    
    0 讨论(0)
  • 2020-12-12 20:43
     <RatingBar     android:id="@+id/id_tv_rating_bar"
                    style="@style/Widget.AppCompat.RatingBar.Small"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/_20sdp"
                    android:layout_marginLeft="@dimen/_80sdp"
                    android:numStars="5"
                    android:paddingTop="@dimen/_5sdp"
                    android:rating="5" />
    

    Just use style="@style/Widget.AppCompat.RatingBar.Small" it'll work for Sure!

    0 讨论(0)
  • 2020-12-12 20:45

    The below snippet worked for me to resize the ratingBar

    <RatingBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/ratingBar"
        style="?android:attr/ratingBarStyleIndicator"
        android:scaleX=".5"
        android:rating="3.5"
        android:scaleY=".5"
        android:transformPivotX="0dp"
        android:transformPivotY="0dp"
        android:max="5"/>
    

    0 讨论(0)
提交回复
热议问题