I'm able to create customized icon for rating bar, but I would like to add different rating bar in different situation programmatically.
Is there any way to achieve this rather than initialize in xml file?
I'm able to create customized icon for rating bar, but I would like to add different rating bar in different situation programmatically.
Is there any way to achieve this rather than initialize in xml file?
I have a solution
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, R.style.ProfileRatingBar);
RatingBar rate = new RatingBar(contextThemeWrapper, null, 0);
R.style.ProfileRatingBar
is my custom ratingbar. Code below
<style name="ProfileRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/profile_ratingbar</item>
<item name="android:minHeight">24dp</item>
<item name="android:maxHeight">24dp</item>
</style>
Hope this helps you.