Android的 - 定义自定义组件布局的XML [英] Android - Defining Custom Component Layouts in XML

查看:116
本文介绍了Android的 - 定义自定义组件布局的XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读上创建自定义组件的An​​dr​​oid开发者文档和一件事不清楚,是你是否可以用XML定义组件的布局,然后再利用跨类库。像,例如说,我想创建一个类库称为myComponents,并在那里我想有myTehAwesumsWidget或什么的,我想在XML中定义的布局,我可以包括在引用的类库,XML <? / p>

解决方案

如果您替换类库与Android电子图书馆工程,你描述的一切应该只是罚款。 这里是一个Android库项目用来分发自定义窗口小部件(也包裹在对话框和定制preference)。

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?

解决方案

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

这篇关于Android的 - 定义自定义组件布局的XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆