简体   繁体   中英

Android Rating bar displays only one star

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.

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.

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

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