Android - Defining Custom Component Layouts in XML

天涯浪子 提交于 2019-12-11 22:54:10

问题


i'm reading the android developer docs on creating custom components and one thing that's unclear, is whether you can define the layout of your component using xml and then reuse that across class libraries. like, say for instance, i want to create a class library called myComponents, and in there i want to have myTehAwesumsWidget or whatever, and i want the layout to be defined in xml, can i include that xml in the referenced class library?


回答1:


If you replace "class library" with "Android library project", everything you describe should work just fine. Here is an Android library project that distributes a custom widget (also wrapped in a dialog and custom preference).



来源:https://stackoverflow.com/questions/3868345/android-defining-custom-component-layouts-in-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!