Android custom widget styles: how to put them into a namespace?
Posted
by Matthias
on Stack Overflow
See other posts from Stack Overflow
or by Matthias
Published on 2009-09-21T07:46:06Z
Indexed on
2010/05/17
5:10 UTC
Read the original article
Hit count: 1841
In the ApiDemos, there is a view example called Gallery1 which declares a custom style in attrs.xml, as such:
<declare-styleable name="Gallery1">
<attr name="android:galleryItemBackground" />
</declare-styleable>
now, I want to do the same thing for my widgets, but using a different namespace. However, as soon as I replace the android: namespace with something else, I get this error:
ERROR: In Gallery1, unable to find attribute myns:galleryItemBackground
Unable to find attribute? Why does it look for an attribute I am about to declare? Isn't the point of this file to be able to name your own custom attributes?
It's interesting to note that it works if you do not supply a custom namespace, but just an attribute name.
© Stack Overflow or respective owner