Search code examples
androidattributesstyleable

Android: doesn't not recognize styleable in some case


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 :)


Solution

  • TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Dot);
    a.getColor....