首页 > 学院 > 开发设计 > 正文

activity 转场动画(全局)---随手

2019-11-07 23:53:05
字体:
来源:转载
供稿:网友
###1.在application里面进行添加  android:theme="@style/MyTestAPPTheme"###2. MyTestAppTheme    <style name="MyTestAppTheme" parent="Theme.AppCompat.Light.NoActionBar">        <item name="android:windowBackground">@color/white</item>        <item name="android:windowAnimationStyle">@style/AnimationActivity</item>        <item name="windowActionBar">false</item>        <item name="windowNoTitle">true</item>        <item name="colorPRimary">@color/black</item>        <item name="colorPrimaryDark">@color/black</item>    </style>### 3.    <style name="AnimationActivity" parent="@android:style/Animation.Activity">        <item name="android:activityOpenEnterAnimation">@anim/anim_enter</item>        <item name="android:activityOpenExitAnimation">@anim/anim_exit</item>        <item name="android:activityCloseEnterAnimation">@anim/back_enter</item>        <item name="android:activityCloseExitAnimation">@anim/back_exit</item>

    </style>

###4.各种动画书写anim_enter.xml<set xmlns:android="http://schemas.android.com/apk/res/android"     android:shareInterpolator="false"     android:zAdjustment="top">    <alpha        android:duration="300"        android:fillAfter="true"        android:fillBefore="false"        android:fillEnabled="true"        android:fromAlpha="0.0"        android:interpolator="@android:interpolator/decelerate_cubic"        android:toAlpha="1.0"/>    <scale        android:duration="300"        android:fillAfter="true"        android:fillBefore="false"        android:fillEnabled="true"        android:fromXScale="0.8"        android:fromYScale="0.8"        android:interpolator="@android:interpolator/decelerate_cubic"        android:pivotX="50.0%p"        android:pivotY="50.0%p"        android:toXScale="1.0"        android:toYScale="1.0"/></set>anim_exit.xml<set xmlns:android="http://schemas.android.com/apk/res/android"     android:background="#ff000000"     android:zAdjustment="normal">    <alpha        android:duration="300"        android:fillAfter="true"        android:fillBefore="false"        android:fillEnabled="true"        android:fromAlpha="1.0"        android:interpolator="@android:interpolator/decelerate_quint"        android:toAlpha="0.0"/></set>back_enter.xml<set xmlns:android="http://schemas.android.com/apk/res/android"     android:zAdjustment="normal">    <alpha        android:duration="300"        android:fillAfter="true"        android:fillBefore="true"        android:fillEnabled="true"        android:fromAlpha="1.0"        android:toAlpha="1.0"/></set>back_exit.xml<set xmlns:android="http://schemas.android.com/apk/res/android"     android:shareInterpolator="false"     android:zAdjustment="top">    <alpha        android:duration="300"        android:fillAfter="true"        android:fillBefore="true"        android:fillEnabled="true"        android:fromAlpha="1.0"        android:interpolator="@android:interpolator/decelerate_cubic"        android:toAlpha="0.0"/>    <scale        android:duration="300"        android:fillAfter="true"        android:fillBefore="true"        android:fillEnabled="true"        android:fromXScale="1.0"        android:fromYScale="1.0"        android:interpolator="@android:interpolator/decelerate_cubic"        android:pivotX="50.0%p"        android:pivotY="50.0%p"        android:toXScale="0.8"        android:toYScale="0.8"/></set>项目中用到,随手进行整理.
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表