How to implement a swipe-gesture between Fragments?
Asked Answered
I

1

11

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.

Izaguirre answered 3/9, 2013 at 11:35 Comment(0)
W
15

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

Whimsy answered 3/9, 2013 at 11:38 Comment(8)
Please take a look at the question link I posted. There I explain in detail how the ViewPager works.Whimsy
I know, but i didn't use ListFragment Or FragmentActivity for main_activityIzaguirre
That doesn't matter. You do not need to use a ListFragment. Just use whatever Fragment you want, just make sure its a support.v4.Fragment.Whimsy
Concerning the FragmentActivity: Can't you just let your Activity extend FragmentActivity?Whimsy
I checked in support.v4.Fragment "Fragment" doesn't findIzaguirre
That is probably because you do not have the Support-Libary included in your project: Here is how to do that: developer.android.com/tools/support-library/setup.htmlWhimsy
let us continue this discussion in chatIzaguirre
i'm testing i use this example developer.android.com/… i use action bar with table listener with android.support.v4.Fragment i got an error i follow tutorial and swipe work, but i want to show l'action barIzaguirre

© 2022 - 2024 — McMap. All rights reserved.