Android: не распознает стиль в некоторых случаях
Я добавил некоторые атрибуты в файл attr.xml
, Вот его код:
<?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>
Но я не знаю почему, когда я использую:
R.styleable.gallery_view_android_galleryItemBackground
: Нет ошибок.
R.styleable.Dot_color
заметит ошибку, потому что не может видеть это поле в R файле.
Пожалуйста, помогите мне об этом.
Спасибо:)
1 ответ
Решение
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Dot);
a.getColor....