1

Through layout.xml it is working.

<RatingBar 
  android:id="@+id/hotel_rating_bar"
  style="@style/custom_ratingbar" />

But i want to set the style Dynamically.

Any Answer will be highly appreciated...

Amit Gupta
  • 8,914
  • 1
  • 25
  • 33

1 Answers1

2

Dynamically changing the style of views at runtime is not yet supported in Android, except for TextViews via setTextAppearance.

You have to set the style before the view gets drawn,
either via XML or via Java in the constructor.

RatingBar ratingBar = new RatingBar(context, null, android.R.attr.ratingBarStyleSmall);
jenzz
  • 7,239
  • 6
  • 49
  • 69