Android:在 Eclipse 布局查看器中显示自定义 UI 视图
有谁知道当我将参数放入布局文件时如何让自定义视图对象出现在 Eclipse 的 Android 布局工具中?
如果您不想在此处放置任何代码,那么仅提供资源链接也很好。我没有运气去寻找我想要的东西。
谢谢。
Does anyone know how I can get my custom view object to appear in Eclipse's Android layout tool when I put the parameters in my layout file?
If you don't want to put any code here, just a link to a resource would be great too. I'm not having any luck searching for what I want.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Eclipse 的布局视图中显示视图并不简单。从我所看到的(它根本不是详尽的),使用完全自定义的视图/表面视图并将渲染放置在单独的线程中是行不通的。
但是,如果您基于现有视图(例如从 EditTExt 继承)构建自定义视图并且仅重写 onDraw 方法,则布局管理器将按预期显示您的视图。从 Android View(此处为 EditText)继承的参数将应用于您的自定义 View。自定义参数不会产生影响(我认为)。
Having your view displayed in the Layout View in Eclipse is not straight forward. From what I've seen (it's not exhaustive at all), using a completely custom View / Surface View with the rendering placed in a separete thread does not work.
But if you're building a custom View based on an existing one (for example inheriting from an EditTExt) and only overriding the onDraw method, then the layout manager will display your view as intended. The the parameters inherited from the Android View (here EditText) will apply to your custom View. Custom parameters won't have effects (I think).