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.

Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
lillogoal
  • 203
  • 1
  • 3
  • 11

1 Answers1

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

Community
  • 1
  • 1
Philipp Jahoda
  • 50,880
  • 24
  • 180
  • 187
  • Please take a look at the question link I posted. There I explain in detail how the ViewPager works. – Philipp Jahoda Sep 03 '13 at 11:45
  • I know, but i didn't use ListFragment Or FragmentActivity for main_activity – lillogoal Sep 03 '13 at 11:59
  • 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. – Philipp Jahoda Sep 03 '13 at 12:11
  • Concerning the FragmentActivity: Can't you just let your Activity extend FragmentActivity? – Philipp Jahoda Sep 03 '13 at 12:18
  • I checked in support.v4.Fragment "Fragment" doesn't find – lillogoal Sep 03 '13 at 12:19
  • That is probably because you do not have the Support-Libary included in your project: Here is how to do that: http://developer.android.com/tools/support-library/setup.html – Philipp Jahoda Sep 03 '13 at 12:26
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/36725/discussion-between-lillogoal-and-philipp-jahoda) – lillogoal Sep 03 '13 at 12:46
  • 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 bar – lillogoal Sep 03 '13 at 13:17