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
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" />
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"
... />
<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!
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"/>