BilelBgr
BilelBgr

Reputation: 33

Android change layout by sliding left/right

I tried many times to create a layout that contain multiple layouts and switch between these layouts by sliding left or right like on WhatsApp or Facebook apps.

I have used some LinearLayout, TableLayout and ScrollView but I didn't found the way to achieve it.

Do you have any solution please ?

Upvotes: 1

Views: 2198

Answers (2)

JasperMoneyshot
JasperMoneyshot

Reputation: 357

You probably want to use Androids ViewPager and set up your views as fragments, it has built in swipe gestures to transition through pages so should cover what you need.

Check out this example, it's also got a sample app you can download and test out:

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

Upvotes: 0

frankie015
frankie015

Reputation: 358

What do you want to do is a Material Design Sliding Tabs ? I implemented that functionality in my app following this guide

Upvotes: 1

Related Questions