I want to use a custom ratingbar. I did all the steps said here: http://android-helper.blogspot.com/2011/06/android-custom-ratingbar-example.html
The only problem is this:
No resource found that matches the given name '@style/Widget.RatingBar.Small'.
I've searched and some says that google restric it and do not allow to access this file anymore. I've tried to copy the style from android sdk but it's not a single file, it refers to some other drawable, I need to include them too.
Is there anyway to solve this problem? How can I use this widget? I need it to be small.
thanks
You need to create custom style for custom rating bar. You can try with this in your style.
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
<style name="foodRatingBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/star_rating_bar_full</item>
<item name="android:minHeight">48dip</item>
<item name="android:maxHeight">48dip</item>
</style>
</resources>
and your xml layout will be like this.
<RatingBar
android:id="@+id/ratingbar_default"
style="@style/foodRatingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:numStars="5" />
in your code, use setOnratingbarchangelistener
ratingBar_default
.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar,
float rating, boolean fromUser) {
// TODO Auto-generated method stub
ratingValue = String.valueOf(rating);
System.out.println(ratingValue);
}
});
Hope this will help you.