eclipse中为Android定制GUI组件

发布于 2024-12-26 02:36:04 字数 154 浏览 3 评论 0原文

您知道如何在 Eclipse 中使用内置的 Eclipse GUI 编辑 XML 文件来添加 GUI 组件吗?我正在寻找创建自己的组件,我可以添加该组件,这样我就可以像其他组件一样进行拖放。我一直在寻找教程,但没有找到任何东西。有谁知道该怎么做?

请注意,我正在使用 Java。

You know how in eclipse you can edit the XML file using the built-in eclipse GUI for adding GUI components? I'm looking to create my own component that I can add so I can drag and drop like the rest of the components. I've looked for a tutorial to no avail and couldn't find anything. Does anyone know how to do this?

Mind you I am using Java.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

琉璃梦幻 2025-01-02 02:36:04

您可以通过创建扩展 ViewGroup 或要创建的组件(例如:Button)的类来创建自定义布局或组件。

这将在 xml 图形布局视图的“自定义和库视图”选项卡下显示您的自定义组件。

You can create custom layout or component by creating a class that extends ViewGroup or the component (Ex: Button) that you want to create.

This will display your custom component under "Custom and Library Views" tab in graphical layout view of the xml.

瑾兮 2025-01-02 02:36:04

较新版本的 Android 开发人员工具 (ADT) 支持布局编辑器中的自定义视图。我相信您只需要确保您的自定义视图具有以属性作为参数的构造函数。请观看 Google IO 2011 中的这段视频,其中重点介绍了(现在的)5 次更新之前添加的一些内容:http://www.youtube.com/watch?v=Oq05KqjXTvs

The newer versions of the android developer tools (ADT) supports custom views in the layout editor. I believe you need just make sure that your custom view has the constructor that takes attributes as an argument. Check out this video from Google IO 2011 which highlights some of the additions from the (what is now) 5 updates ago: http://www.youtube.com/watch?v=Oq05KqjXTvs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文