开发者

Android: Is it Possible to Add Custom Attributes to Extended Views?

开发者 https://www.devze.com 2023-01-29 19:52 出处:网络
I know I can extend an Android view and have seen the Notepad example of doing this.I was wondering if it is possible in addition to add new custom attributes for the view that would parse properly in

I know I can extend an Android view and have seen the Notepad example of doing this. I was wondering if it is possible in addition to add new custom attributes for the view that would parse properly in the XML declarations of the custom view. I'm a bit of a novice at XML technology.

I read here that I can somehow add custom attributes in the custom view's constructor, but there is no detail given and no example shown.

Ideally I would also like to be able to extend the ADT visual layout previewer/editor to support the custom views (rendering them with my custom code and having the custom properties show up in the context menu, etc.)

I would love to be able to do this but am not sure it's feasible or even possible. I read开发者_运维知识库 that XML schema may or may not be extensible: "extend" an xml schema

If this scenario isn't directly supported, does someone know where to find the Android schema so I might be able to modify it directly?


the panel widget in this project has its on xmlns its a pretty solid example not sure about your ADT question either http://code.google.com/p/android-misc-widgets/


I found the answer myself. The ApiDemos LabelView application has an example of this. I haven't yet verified whether or not the visual editor shows the custom behavior though.

0

精彩评论

暂无评论...
验证码 换一张
取 消