How to implement a swipe-gesture between Fragments?

♀尐吖头ヾ 提交于 2019-12-09 08:56:13

问题


I would like to implement in my android app that I'm developing with the Android studio ide. The swipe between the different tabs (fragment). I tried searching online and on StackOverflow but I could not quite understand. My action bar is the classic one that works with Android above 3.0 If you can give me some advice or examples of aid etc. I shall be very grateful. With this I thank you.


回答1:


I suppose the Android ViewPager is what you are looking for:

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

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.

Also take a look at this question:

How to implement a ViewPager with different Fragments / Layouts

And how to include the Support-Library: http://developer.android.com/tools/support-library/setup.html



来源:https://stackoverflow.com/questions/18591265/how-to-implement-a-swipe-gesture-between-fragments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!