如何在 main.xml 中膨胀视图类

发布于 2024-09-13 00:52:21 字数 201 浏览 10 评论 0原文

我如何使用 main.xml 文件来扩展我的自定义视图?我认为它具有以下格式

<com.blah.project.MainClass.innerClass /> 

,但我似乎无法正确获得内部类的完全限定名称。我的 customView 位于我的 Main.java 文件中,有人知道我如何正确引用它吗?谢谢。

How could i inflate my custom view using the main.xml file? I thought it carried the format of

<com.blah.project.MainClass.innerClass /> 

but I cant seem to get the fully qualified name of my inner class right. My customView is inside of my Main.java file, anyone know how I could properly reference it? Thank you.

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

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

发布评论

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

评论(2

你的笑 2024-09-20 00:52:21

尝试
或分离视图类。

try <view class="com.blah.project.MainClass$innerClass" ... />
or separate the view class.

口干舌燥 2024-09-20 00:52:21

是的,但我缺少的是,为了使其膨胀,必须将视图声明为静态。

it is , but what i was missing is that in order for it to be inflated, the view must be declared static.

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