当前位置: 移动技术网 > 移动技术>移动开发>Android > Android 补间动画之页面切换动画

Android 补间动画之页面切换动画

2020年09月01日  | 移动技术网移动技术  | 我要评论
## Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画:逐帧动画的原理很简单,就是将一个完整的动画拆分成一张张单独的图片,然后将它们连贯起来进行播放;补间动画是专门为View提供的动画,可以实现View的透明度、缩放、平移和旋转四种效果。cc: 补间动画:(平移、缩放、旋转和透明度)#1 TranslateAnimation#2 ScaleAnimation#3 RotateAnimation#4 AlphaAnimation

## Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画
逐帧动画的原理很简单,就是将一个完整的动画拆分成一张张单独的图片,然后将它们连贯起来进行播放;
补间动画是专门为View提供的动画,可以实现View的透明度、缩放、平移和旋转四种效果。

cc: 补间动画:(平移、缩放、旋转和透明度)

#1 TranslateAnimation
#2 ScaleAnimation
#3 RotateAnimation
#4 AlphaAnimation


#1 页面切换-淡入/淡出

<!-- fade_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="0.0" android:toAlpha="1.0"
        android:duration="300" />
</set>
<!-- fade_out.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="1.0" android:toAlpha="0.0"
        android:duration="300" />
</set>

 

#2 页面切换- 向下弹入/弹出

<!-- slide_down_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="300"
        android:fromYDelta="-100%p"
        android:toYDelta="0" />
</set>
<!-- slide_down_out.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <translate
        android:duration="@integer/default_animation_long"
        android:fromYDelta="0"
        android:toYDelta="100%p" />
</set>

 

#3 页面切换- 向上弹入/弹出

<!-- slide_up_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromYDelta="100%p"
        android:toYDelta="0" />
</set>
<!-- slide_down_out.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromYDelta="0"
        android:toYDelta="-100%p" />
</set>

 

#4 页面切换-右进右出

<!-- slide_right_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromXDelta="100%p"
        android:toXDelta="0"/>
</set>
<!-- slide_right_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromXDelta="0"
        android:toXDelta="100%p"/>
</set>

 

#5 页面切换-左进左出

<!-- slide_left_in.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromXDelta="-100%"
        android:toXDelta="0"/>
</set>
<!-- slide_left_out.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromXDelta="0"
        android:toXDelta="-100%p"/>
</set>

 

 

本文地址:https://blog.csdn.net/qq_20613731/article/details/108558729

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网