hqt
hqt

Reputation: 30276

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

Upvotes: 1

Views: 754

Answers (1)

Hai Bo Wang
Hai Bo Wang

Reputation: 642

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

Upvotes: 0

Related Questions