Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Single Activity with two fragments that are swipable for a full screen activity

Hi , I am trying to create an activity that has the following two pages divided into two fragments that are swipable. Following is the image attached .

http://cl.ly/image/0y1T3s1v0c2S

2 Answers

Hi Samar, you can check these out, on how to go about it Swipe Views and this tutorial Creating Swipe Views. Good luck.

Thanks Gloria For your quick response . But I am not able to understand. I want to have two independent fragment which become a full screen activity once swiped . To explain it better I have created a new mockup : http://cl.ly/image/2A3e0I2a1L40

I basically have two different layouts in one activity . Is it possible to use ViewGroup and a ViewFlipper to achieve this ?

Yes you can use ViewGroup to do that. Maybe this tutorial is clearer - Android Fullscreen Image Slider with Swipe and Pinch Zoom Gestures. Focus more on the area where it shows how to swipe. If you look at the swiped images below there is one that looks like your mockup :)

Hey Gloria.. Thanks ! This looks close to what I am looking for .The only difference is that here an ImageView is a Fullscreen activity which is swipable to get the next image()fullscreen activity). In my case I need a layout view as a half-screen activity which becomes a fullscreen activity if swiped in its respective direction. But I think that this is modifiable since it extends a ViewGroup.

Thanks !