创建一个打开所有意图的视图
我正在集思广益,突然想到一个主意,这将使我的处境变得容易得多。
基本上,我希望音乐播放器在屏幕底部的所有活动中可见。为此,我创建了一个 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的就是只有一个
Activity
,然后运行 Fragments
中的其他所有内容。您所有的
Activity
需要处理的就是替换内容Fragment
。我发现自己现在词穷,所以如果你对我的意思有任何疑问,请随意拍摄。
What you could do is have just one
Activity
and then run everything else inFragments
.All your
Activity
what need to handle is replacing the contentFragment
.I find myself short on words right now, so if you have any questions as to what I mean, feel free to shoot.