Reputation: 81
I am attempting to use a view flipper to animate the transition between 2 views. It seems that, by default, the ViewFlipper places the Out animation above the In animation in Z order. Is there a way to get the incoming animation to display over the outgoing animation?
Thanks
Upvotes: 3
Views: 760
Reputation: 70416
You can find this feature in the Android Launcher. Since Android is open source you can just copy and work with it.
Take this code called DragableSpace: http://pastebin.com/CgK8TCQS. In your activity you call:
setContentView(R.layout.main);
with:
<?xml version="1.0" encoding="utf-8"?>
<de.android.projects.DragableSpace
xmlns:app="http://schemas.android.com/apk/res/de.android.projects"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/space"
android:layout_width="fill_parent" android:layout_height="fill_parent"
app:default_screen="1">
<include android:id="@+id/left" layout="@layout/left_screen" />
<include android:id="@+id/center" layout="@layout/initial_screen" />
<include android:id="@+id/right" layout="@layout/right_screen" />
</de.android.projects.DragableSpace>
Like you can see you can define a homescreen for your application using just xml ;)
Define each view (initial, right and left) like this:
<LinearLayout android:id="@+id/center"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="@color/orange">
<Button android:text="Initial Screen" android:id="@+id/Button2"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="10dp" android:layout_margin="10dp">
</Button>
</LinearLayout>
For more information check out this question: Developing an Android Homescreen
Upvotes: 0