安卓:FragmentActivity在FragmentActivity(滚动型导航栏中) [英] Android: FragmentActivity in FragmentActivity (Scrollview in Navigationbar)

查看:225
本文介绍了安卓:FragmentActivity在FragmentActivity(滚动型导航栏中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个FragmentActivity可以经由ViewPager和它承载的动作条用于导航FragmentActivity几个片段刷卡。

I have a FragmentActivity which can swipe through several fragments via ViewPager and a FragmentActivity which hosts an ActionBar for navigation.

现在我想窝在其中承载的ActionBar其他FragmentActivity的第一个片段与ViewPager的FragmentActivity。

Now I want to nest the FragmentActivity with the ViewPager in the first fragment of the other FragmentActivity which hosts the ActionBar.

在我喜欢有一个ActionBar的导航换句话说,并在这我想有滑动式片段第一个标签。

In other words I like to have an ActionBar navigation and in it's first Tab I'd like to have swipeable fragments.

我的问题是如何嵌套1 FragmentActivity在另一个FragmentActivity。对自己的两个工作,但我不会让他们一起工作。

My problem is how to nest one FragmentActivity in another FragmentActivity. Both work on their own but I don't get them to work together.

推荐答案

<一个href=\"http://stackoverflow.com/questions/18821775/swipe-gesture-applied-at-fragment-level-along-with-viewpager-with-its-default-s/19020100#19020100\">Swipe在片段级别应用一起ViewPager与它的姿态是默认禁用刷卡

您可以编写自己的触摸拦截器视图寻呼机里面的片段。

You can write your own touch interceptor for the fragments inside your view-pager.

然而在第二个意见,请参阅我的moqup的问题:

However on a second opinion, please see my moqup in the question:

您可以有多个集装箱的ViewGroup preferably的FrameLayout,其中每个可以添加或使用事务删除片段。导航面板的容器是比在该ViewPager是显示不同:

You can have several ViewGroup container preferably FrameLayout, where on each you can add or remove fragments using transactions. The container of the Navigation Panel is different than where the ViewPager is showing:

请这ViewPager中,在又一个的FrameLayout产生一个独立的片段。在这里ViewPager你不应该使用FragmentPageAdapter,但经常PagerAdapter(避免碎片嵌套)。因此,ViewPager是他们显示的意见,而不是碎片父容器。

Keep this ViewPager in a separate fragment that spawns in yet another FrameLayout. in ViewPager here you should not use the FragmentPageAdapter, but a regular PagerAdapter (avoid nesting of fragments). Hence the ViewPager is a parent container for the Views, and not Fragments where they are shown.

抽屉式导航栏(项目点击)的目标将是本次的FrameLayout。保持简单!

The target of the navigation drawer (on item click) will be this second FrameLayout. Keep it simple!!

同样你可以有一个ViewPager基于标签ViewPager与这个新发现的信息,第一个选项卡中。

Similarly you can have a ViewPager inside a first tab of Tab based ViewPager with this new found information.

这篇关于安卓:FragmentActivity在FragmentActivity(滚动型导航栏中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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