创建一个打开所有意图的视图

发布于 2024-12-19 09:06:01 字数 457 浏览 0 评论 0原文

我正在集思广益,突然想到一个主意,这将使我的处境变得容易得多。

基本上,我希望音乐播放器在屏幕底部的所有活动中可见。为此,我创建了一个 Fragment ,它可以很好地完成工作,但手动将其添加到所有活动中确实很痛苦。尤其是在 ListActivities 上,这似乎是有问题的。

所以我在想,是否有可能创建一个活动,其中所有其他活动都将被打开? 想象一个包含单个视图和音乐播放器片段的主覆盖层(FrameLayout)。当前主屏幕在此视图中打开,并且对于源自该主屏幕的所有活动也是如此。

这样的事情可能吗?这在我的脑海中听起来是一个非常简单的想法,但据我所知,我从未见过类似的事情,这让我觉得这可能是不可能的。

想法

有点像这样。

I was doing some brainstorming and I suddenly got an idea which would make my situation a whole lot easier.

Basically, I want a music player visible on all my activities at the bottom of the screen. To do so I created a Fragment which does the job fine, but it's a real pain adding it on all activities manually. Especially on the ListActivities this seems problematic.

So I was thinking, is it possible to create one activity in which all other activities will be opened?
Think of a main overlay (FrameLayout) that contains a single view, and the music player fragment. The current main screen gets opened in this view, and the same goes for all activities originating from this main screen.

Would anything like this be possible? It sounds like a really simple idea in my head, but as far as I can remember I've never seen anything like it which makes me think it might not be possible.

Idea

Kind of like so.

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

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

发布评论

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

评论(1

飘然心甜 2024-12-26 09:06:03

您可以做的就是只有一个 Activity,然后运行 ​​Fragments 中的其他所有内容。

您所有的Activity需要处理的就是替换内容Fragment

我发现自己现在词穷,所以如果你对我的意思有任何疑问,请随意拍摄。

What you could do is have just one Activity and then run everything else in Fragments.

All your Activity what need to handle is replacing the content Fragment.

I find myself short on words right now, so if you have any questions as to what I mean, feel free to shoot.

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