views:

46

answers:

1

I don't see any method like setStyle for class RatingBar, how can i set rating style from code

A: 

You need to set it in xml file! If you like to change it on the run, you can have two different View-s (rb) and switch them in the program (add/remove from layout) or use rb1.setVisibility(View.VISIBLE) and rb2.setVisibility(View.GONE);

<RatingBar 
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:layout_alignParentRight="true" android:id="@+id/rb1"
    style="?android:attr/ratingBarStyleSmall"
    android:clickable="false" android:numStars="5">
</RatingBar>
MatejC