Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android- ADT 18.0 styles

Tags:

android

adt

Previously i used the ADT10.0 . In this version i am not getting any errors regarding styles. After i updated my ADT to 18.0. Now i got the following error.

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Widget.RatingBar.Small'.

How can I solve this? I saw somewhere to solve this import the styles using http://source.android.com/source/downloading.html but it's not understandable please can any body help me?

<style name="reviewRatingBar1" parent="@android:style/Widget.RatingBar.Small" >

    <item name="android:progressDrawable">@drawable/review_rating_bar_full</item>
    <item name="android:minHeight">13dip</item>
    <item name="android:maxHeight">13dip</item>
</style>
like image 833
naresh Avatar asked May 04 '26 03:05

naresh


1 Answers

According to the android.R.style documentation there isn't a Widget.RatingBar.Small style (any longer), which appears to be the reason why Eclipse is giving you that error.

Comparing the styles.xml files from e.g. API level 7 and 15 it appears that the style isn't public anymore. If I try to reference it in Eclipse, I actually get an error message that confirms this

Error: Resource is not public. (at 'style' with value '@android:style/Widget.RatingBar.Small').

As far as I can tell, there are several options you have here:

  1. Do as @havexz suggests and copy over the original style and referenced resources. Unfortunately, this will give your stars a fixed appearance on every device. In other words: you don't get the ability to use theme-based resources from e.g. the device's manufacturer and the stars will look different from what the user is used to.
  2. Reference style="?android:attr/ratingBarStyleSmall" when you declare the RatingBar. You can, however, not inherit from this theme-based style, so any customizations to the default 'small' style will have to be copied over to all your other small rating bars.
  3. If you target Honeycomb or above devices, you could refer to Widget.Holo.RatingBar.Small or Widget.Holo.Light.RatingBar.Small. You probably design your app against either one, so you'll know at design time which style to inherit from.
  4. It appears you limit the height of the small RatingBar further down anyhow, so you may be able to get away with just inheriting from the regular RatingBar style?
like image 56
MH. Avatar answered May 05 '26 15:05

MH.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!