如何实现片段之间的横向卷轴/刷卡? [英] How to implement a horizontal scroll / swipe between Fragments?

查看:171
本文介绍了如何实现片段之间的横向卷轴/刷卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现我的应用程序像Pinterest的或Trello导航,也就是那种三个标签导航+水平滚动。 我做了一个自定义的TabBar这个(因为我无法猜测如何改变标签宽度在我的动作条导航选项卡模式)。所以,我有三个按钮来浏览从一个片段到另一个。现在,我想实现的水平滚动像这两个例子,来也属于我的片段导航。 我看了一下查看传呼机,但我不知道它是否适合我的情况下,因为我没有只是意见,但片段。没有任何人有一个例子或如何做到这一点的想法?我可以运用它的不同活动之间? 谢谢

I would like to achieve a navigation in my app like Pinterest or Trello, that is, kind of three tabs to navigation + horizontal scrolling. I have made a custom tabbar for this (since I couldn't guess how to change tabs width in my actionbar with navigation TAB mode). So I have three buttons to navigate from one fragment to another. Now I would like to implement the horizontal scrolling like these two examples, to also navigate among my fragments. I have read about View Pager but I don't know if it fits to my case, since I don't have only views but fragments. Does anybody have an example or an idea of how to do it? Could I apply it among different activities? Thanks

推荐答案

请看一看,我刚才已经回答重复的问题:

Please take a look at the duplicate question that I just answered:

<一个href="http://stackoverflow.com/questions/18591265/how-to-implement-a-swipe-gesture-between-fragments/18591363#18591363">How片段之间实现轻扫手势?

How to implement a swipe-gesture between Fragments?

我想在安卓ViewPager 是你在找什么:

http://developer.android.com/reference/android/support/v4/view/ViewPager.html

下面是一个很好的教程如何实现它:

Here is a nice tutorial on how to implement it:

http://developer.android.com/training/animation /screen-slide.html

http://developer.android.com/training/animation/screen-slide.html

其基本思想是,你有多个片段,每个重presenting   不同的画面。的ViewPager使用户之间进行刷卡   不同的片段,并显示不同的内容。

The basic idea is that you have multiple Fragments, each representing a different Screen. The ViewPager enables the user to swipe between the different Fragments and display different content.

这篇关于如何实现片段之间的横向卷轴/刷卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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