Android activity Toggle-the effect of left and right swipe

Source: Internet
Author: User

At first I gave the activity to define the switching action, do not know why the effect has not come out, switching actions are the default Android. Later asked others, changed the change finally good, why I do not know. But if you encounter the problem of activity switching, you can directly apply my style, the code is as follows:

1. This is a style file:

<stylename="Thememain"parent="Android:theme"> <Itemname="Android:windowframe"> @null </Item> <Itemname="Android:windowbackground"> @android: color/transparent</Item> <Itemname="Android:background"> @null </Item> <Itemname="Android:colorbackgroundcachehint"> @null </Item> <Itemname="Android:windownotitle">true</Item> <Itemname="Android:windowsoftinputmode">stateunspecified|adjustpan</Item> <Itemname="Android:windowanimationstyle"> @style/style1</Item></style><stylename="Style1"parent="@android: Style/animation.translucent"> <Itemname="Android:windowenteranimation"> @anim/enter_from_left</Item> <Itemname="Android:windowexitanimation"> @anim/exit_to_left</Item></style>
2. This is enter_from_left.xml:

<?XML version="1.0"encoding="Utf-8"?><Setxmlns:android="Http://schemas.android.com/apk/res/android"    android:shareinterpolator="false"> <Translate        android:fromxdelta=" -100%"        android:toxdelta="0%"        android:fromydelta="0%"        android:toydelta="0%"        android:duration="+"/></Set>
3. This is exit_to_left.xml:

<?XML version="1.0"encoding="Utf-8"?><Setxmlns:Android="Http://schemas.android.com/apk/res/android"    Android: shareinterpolator="false"> <Translate        Android: Fromxdelta="0%"        Android: Toxdelta=" -100%"        Android: Fromydelta="0%"        Android: Toydelta="0%"        Android:d uration="+"/></Set>
4. This manifest.xml configuration file:

<Activity    Android: Name=". Main. Mainactivity "    Android: Theme="@style/thememain"> <Intent-filter> <ActionAndroid: Name="Android.intent.action.MAIN"/> <categoryAndroid: Name="Android.intent.category.LAUNCHER"/> </Intent-filter></Activity>
5. This is the Enter_from_right.xml file:
<?XML version="1.0"encoding="Utf-8"?><Setxmlns:Android="Http://schemas.android.com/apk/res/android"    Android: shareinterpolator="false"> <Translate        Android: Fromxdelta="100%"        Android: Toxdelta="0%"        Android: Fromydelta="0%"        Android: Toydelta="0%"        Android:d uration="+"/></Set>
6. This is the Exit_to_right.xml file:
<?XML version="1.0"encoding="Utf-8"?><Setxmlns:Android="Http://schemas.android.com/apk/res/android"    Android: shareinterpolator="false"> <Translate        Android: Fromxdelta="0%"        Android: Toxdelta="100%"        Android: Fromydelta="0%"        Android: Toydelta="0%"        Android:d uration="+"/></Set>
Everyone according to my template to configure style files and manifest file on the line, there are any questions can leave a message ~ ~ ~


Android activity Toggle-the effect of left and right swipe

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.