交换视图或交换活动作为布局的一部分?

发布于 2024-11-30 19:52:47 字数 418 浏览 2 评论 0原文

我为我的应用程序创建了一个自定义导航栏。它(当前)所做的一件事是允许您在应用程序中的各种活动之间切换。我还没有完全解决的一个问题是,当上面的视图切换到另一个活动时,如何保持 UI 上的导航栏不变。

此 Google 群组帖子似乎提出了这个问题和解决方案似乎围绕使用 LocalActivityManager 将新活动的 Window 装饰添加到当前布局的 ViewGroup 中。我很好奇以前是否有人这样做过以及他们的想法是什么?

我特别对 LocalActivityManager/多个活动方法与切换多个视图(而不是活动)的一个超级活动的优缺点感兴趣。

I've created a custom navigation bar for my application. One of the things it (currently) does is allow you to switch between various activities in the application. One part I still have yet to solve fully is how to keep the navigation bar constant on the UI while the view above it switches to another activity.

This google groups thread seems to ask this very question and the solution seems to revolve around using a LocalActivityManager to add the Window decor of the new activity to a ViewGroup of your current layout. I'm curious if anyone has done this before and what their thoughts were?

In particular I'd be interested in the pros/cons of the LocalActivityManager/multiple activities approach vs one super activity which switches multiple views (rather than activities).

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

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

发布评论

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

评论(1

辞旧 2024-12-07 19:52:47

我猜想 Fragments 将是现在完成此任务的推荐方法: http:// developer.android.com/guide/topics/fundamentals/fragments.html 它们具有类似于活动的生命周期,但旨在从布局中添加和删除。通过兼容性库 (http://android-developers.blogspot.com/2011/03/fragments-for-all.html),您可以一直使用它们直到操作系统 v1.6。作为奖励,这是操作系统自 v3.0 以来在可重用 UI 组件方面的发展方式,因此您应该为未来做好准备。

I would guess that Fragments would be the recommended way to accomplish this now: http://developer.android.com/guide/topics/fundamentals/fragments.html They have a lifecycle like activities but are meant to be added and removed from layouts. With the compatibility library (http://android-developers.blogspot.com/2011/03/fragments-for-all.html) you can use them all the way back to OS v1.6. As a bonus this is the way that the OS has been moving in terms of reusable UI components since v3.0, so you should be in better shape for the future.

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