Sliding views in the same activity

glbproject

New member
Sep 11, 2015
1
0
0
Visit site
Hi everybody!
First of all I want to excuse me if I ask something that seems easy to you, but I'm a beginner developer.

I'm developing an app and I would like to slide beetween views in the same activity:

Code:
<LinearLayout ... orientation:horizontal>
      <LinearLayout L1>
      </LinearLayout>
      <LinearLayout L2>
      </LinearLayout>
      <LinearLayout L3>
      </LinearLayout>
      <LinearLayout L4>
      </LinearLayout>
</LinearLayout>

In the activity I'll want to show L1 in the center and sliding left I will show L2 (that is out of screen, then, when in the center, L1 disappear to left) .. and so on sliding left or right

Anyone could suggest me a way to do this ? (hope it's clear :( )
Thanks
 

Svvorf

Member
Sep 17, 2015
10
0
0
Visit site
There is a widget called ViewPager having exactly your use case. You can refer to the documentation, it's not so hard to implement.