I am using
Android RatingBar change star colors
This line of code
LayerDrawable stars = (LayerDrawable) rating_bar.getProgressDrawable();
>
Creating a subclass of RatingDialog and using that instead ofandroid.widget.RatingBar
worked for me. Here is the code I used.
Subclass:
public class RatingBar extends android.widget.RatingBar {
public RatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public RatingBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
}
Then in my layouts:
Then in the classes where you are casting the class, just use your.package.RatingBar
instead of android.widget.RatingBar