switching between activities using Touch screen

1.9k views Asked by At

want to change activities by dragging the page using touch event. I have used Flipper, but by using flipper animations are performed automatically, but i want to drag the screen by finger or by mouse

1

There are 1 answers

0
Chris On

I found a really great class for that purpose which did great for me. This one isn't capable of really switching activitys but you can switch multiple "screens" or "forms".

There is no library for that i found it in that question here (What is important is the Java File "DragableSpace.java":

Android Homescreen

You can't see there how to use it in your layout so here is my example:

<com.matthieu.launcher.DragableSpace xmlns:app="http://schemas.android.com/apk/res/com.matthieu.launcher"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/space"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<include android:id="@+id/left"  layout="@layout/artists" />
<include android:id="@+id/center"  layout="@layout/releases" />
<include android:id="@+id/right"  layout="@layout/labels" />

</com.matthieu.launcher.DragableSpace>

You can include as many "screens" as you like which basicly are just links to other layout files. Than you can switch these screens by dragging (like the homescreens).