1

I have added some attributes into file attr.xml. Here its code:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <declare-styleable name="gallery_view">
        <attr name="android:galleryItemBackground"/>
    </declare-styleable>  

     <declare-styleable name="Dot">
        <attr name="color" format="color"/>
        <attr name="radius" format="dimension"/>
     </declare-styleable>

</resources>

But I don't why when I use:

R.styleable.gallery_view_android_galleryItemBackground: no error.

R.styleable.Dot_color will notice error because cannot see this field in R file.

Please help me about this.

Thanks :)

hqt
  • 29,632
  • 51
  • 171
  • 250
  • 1
    **The android.R.styleable class and its fields were removed from the public API**, Check this: http://stackoverflow.com/questions/6675403/r-styleable-can-not-be-resolved-why/6675824#6675824 – Paresh Mayani Mar 16 '12 at 06:48
  • 2
    Sorry, but at my first case, I still can use it. Explain for me,please. Thanks :) – hqt Mar 16 '12 at 06:55

1 Answers1

0
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Dot);
a.getColor....
Hai Bo Wang
  • 632
  • 3
  • 6
  • 2
    Can you explain more, please. But, I still get the same error when try to get `R.styleable.DOT` – hqt Mar 16 '12 at 08:24
  • http://developer.android.com/reference/android/content/res/Resources.Theme.html#obtainStyledAttributes(int, int[]) – Hai Bo Wang Mar 16 '12 at 12:31