[Android] mobile guard UI switching animation, android guard

Source: Internet
Author: User

[Android] mobile guard UI switching animation, android guard

Create a file tran_out.xml in/res/anim/

Add a <translate> node

Set the X axis source coordinate android: fromXDelta = "0"

Set the x-axis coordinate. android: toXDelte = "-100% p" indicates the entire parent form.

Set Y axis source coordinates android: fromYDelta = "0"

Set the Y axis to android: toYDelta = "0"

Set the execution time android: duration = "500" 500 ms

 

Create a file tran_in.xml in/res/anim/

Add a <translate> node

Set the x-axis source coordinate android: fromXDelta = "100% p" for the entire parent form

Set the X axis coordinate android: toXDelte = "0"

Set Y axis source coordinates android: fromYDelta = "0"

Set the Y axis to android: toYDelta = "0"

Set the execution time android: duration = "500" 500 ms

 

On the activity jump page

After startActivity () and finish () Methods

Call the overridePendingTransition () method. Parameter: R. anim. xxx_in, R. anim. yyyyy_out

 

However, on my simulator, the activity is black screen when it is removed from the left. I haven't found the reason for searching for a long time. It's strange.

Trans_in.xml

<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="500"    android:fromXDelta="100%"    android:fromYDelta="0"    android:toXDelta="0"    android:toYDelta="0" ></translate>

Trans_out.xml

<?xml version="1.0" encoding="utf-8"?><set  xmlns:android="http://schemas.android.com/apk/res/android">    <translate        android:fromXDelta="0"        android:toXDelta="-100%"        android:duration="300"        /></set>

Trans_pre_in.xml

<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="500"    android:fromXDelta="-100%p"    android:fromYDelta="0"    android:toXDelta="0"    android:toYDelta="0" ></translate>

Trans_pre_out.xml

<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="500"    android:fromXDelta="0"    android:fromYDelta="0"    android:toXDelta="100%p"    android:toYDelta="0" ></translate>

 

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.