xXJJJasonMokXx
xXJJJasonMokXx

Reputation: 367

Android: two pages activity

Simple question:

I want an activity to have two or multiple pages,like a launcher does.

I think this should be done with fragments but I am a newbie developer,so I don't have much idea on working this with fragments.

Basically the user swipes right or left to change the "page", any ideas?

Upvotes: 0

Views: 106

Answers (2)

W3hri
W3hri

Reputation: 1591

I think that a ViewPager will fit yout needs:

Using ViewPager for Screen Slides

Your Activity will contain a Viewpager, wich will hold several Fragments for the Pages you want to display. Navigationg the pages by swiping left and right will be handled automatcally.

Upvotes: 2

Muhammad Kashif Nazar
Muhammad Kashif Nazar

Reputation: 23855

One idea is to use a ViewSwitcher. You can define multiple views inside a single Layout XML file and switch the views when the user swipes left or right.

Upvotes: 1

Related Questions