2

I have created custom style for RatingBar and when I apply my style to rating bar, it shows only one star, and in properties of RatingBar, I've define the size of the start which 5 as well, but on run time it displays only one star. Note:I am using ActionbarActivity, in that I am displaying RatingBar, but when I use only Activity class, it displays 5 star and the theme is also applied on that. So Please help me out from this issue.

PriyankaChauhan
  • 1,030
  • 10
  • 26
Harsh Shah
  • 21
  • 6

2 Answers2

9

check if you are using Vector Drawable which is causing this issue. So to work with it try to replace Vector Drawable with png image in the drawable folder and see the magic it work.

you are using Vector Drawable with layer-list so your Vector Drawable image is fit to the whole layout try to replace it with png which will solve your problem.

Amal Kronz
  • 1,567
  • 1
  • 14
  • 20
0

Try this in XML:

<RatingBar
   android:id="@+id/rating_bar"
   style="?android:attr/ratingBarStyleSmall"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:rating="3.5" />
Diego Venâncio
  • 4,095
  • 2
  • 31
  • 56