android - No resource found that matches the given name '@style/Widget.RatingBar.Small' -
i want utilize custom ratingbar. did steps said here: http://android-helper.blogspot.com/2011/06/android-custom-ratingbar-example.html
the problem this:
no resource found matches given name '@style/widget.ratingbar.small'. i've searched , says google restric , not allow access file anymore. i've tried re-create style android sdk it's not single file, refers other drawable, need include them too.
is there anyway solve problem? how can utilize widget? need small.
thanks
you need create custom style custom rating bar. can seek in 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 xml layout 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 code, utilize 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 help you.
android android-custom-view
No comments:
Post a Comment