如何使用多个片段在不同时期单一的活动 [英] How to use multiple Fragment in single activity in different times

查看:107
本文介绍了如何使用多个片段在不同时期单一的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个应用程序中的页眉和页脚是相同的,通过了应用程序。我可以启动另一个活动与设计在页眉和页脚相同的模式,但与其他活动开始总会有这种延迟,我们可以很容易发现,一个新的活动有弹出。

所以,我想:
                 我想,如果用户从页脚页眉和页脚之间的中间点击任何按钮的内容应该变化,用户不应该看到,当我移动到其他活动它是由任何跳跃。

因此​​,对于这个我知道,我可以使用片段。但对于一些原因,我无法使用片段的活性。我只想在仅中心移动片段。那么,如何能做到这一点。我怎么能初始化其他的事情是在新的片段让说即将到来的片段可以有按钮,这样,我想知道这会让我的主要活动重值为调用所有这些片段

所以,请指导我演示code。


  

注意:请不要参考我刚刚过去的一些code片段的链接给我一些想法



解决方案

将是最容易有活动实施页眉和页脚和变量内容片段。

请参考这个帖子。它有你需要的一切
固定页眉和页脚在Android应用

I am making an app in which the header and footer would be same through out the app. i can start another activity with the same pattern of design in header and footer but as the other activity starts there comes a delay and we can easily notice that a new activity has pop up.

So what I want : I want that if user click on any button from the footer the content in the middle between header and footer should be change and user should not see any jump which is made when I move to other activity.

So for this I know that I can use fragments. But for some reasons I can not use fragment activity. All I want to move fragment in the center only. So How can i do that . and How can I initialize other things which are in new fragment let say the upcoming fragment could have button so in this way , I wanted to know would it make my main activity heavy which is calling all these fragment

So please guide me through the demo code .

Note: please do not refer me to a fragment link just past some code to give me some idea.

解决方案

Will be easiest to have the activity implement the header and footer and the variable content as fragments.

Please refer to this post. It has everything you need Fixed header and footer in android app

这篇关于如何使用多个片段在不同时期单一的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆