简体   繁体   中英

switching between activities using Touch screen

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM