I wonder how to change the activity with the slide of the finger, or slide your finger from right to left and change the activity, the way we saw the pictures on smartphones.
Anyone know?
Cumpz
See the following link
http://savagelook.com/blog/android/swipes-or-flings-for-navigation-in-android
I wrote a demo at https://github.com/chenjishi/SlideActivity, all you need to do is extend the SlidingActivity in the project and you get a slide effect,here is the screenshot:
#### old method1.make the activity transparent
<style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar">
<item name="android:windowAnimationStyle">@style/activityAnimation</item>
</style>
2.use SlidingPaneLayout
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slide_panel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E6E6E6"
android:orientation="vertical">
</LinearLayout>
3.so here you get you want
you can slide with your finger to move the activity, and you also can destroy it when sliding to the right most of screen.
Use a ViewPager to achieve what you are looking for. Here is a tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With