使用片段切换活动片段

由网友(鹤卿.)分享简介:我想创建一个具有与它背后滑活动固定页脚的布局。我被告知要使用碎片,但是这将意味着我将不得不对我现有的活动转化为碎片 - 对吗?下面是我想要达到一个图: http://i.imgur.com/K8Iao。 JPG I'm trying to create a layout that has a stationary...

我想创建一个具有与它背后滑活动固定页脚的布局。我被告知要使用碎片,但是这将意味着我将不得不对我现有的活动转化为碎片 - 对吗?下面是我想要达到一个图: http://i.imgur.com/K8Iao。 JPG

I'm trying to create a layout that has a stationary footer with activities that slide behind it. I've been told to use Fragments, but that would mean that I would have to convert my already existing Activities to Fragments - right? Here is a diagram of what I'm trying to achieve: https://p.xsw88.cn/allimgs/daicuo/20230907/5144.png.jpg

推荐答案

我觉得@TarunMaheshwari是想说的是,不是具有 3的活动(如类扩展活动),其中延伸片段(明明有你可能有其他小的改动,以便为code工作),然后创建一个主要活动(与延伸FragmentActivity ),有你想要的可以在3个不同的片段调用静态页脚。

What I think @TarunMaheshwari is trying to say is that instead of having 3 activities (eg. classes with extends activity), replace it with extends fragment (obviously there are other minor changes you might have to make for the code to work) and then create a main activity (with extends FragmentActivity) that has the static footer you want which can call on the 3 different fragments.

推荐阅读:

http://developer.android.com/guide/topics/fundamentals/ fragments.html

HTTP://android-developers.blogspot。 CA / 2011/02 / Android的30块碎片 - api.html

阅读全文

相关推荐

最新文章