阅读背景:

Android动画示例代码

来源:互联网 

1、布局文件:activity_animation_demo.xml

<ScrollView xmlns:android="https://schemas.android.com/apk/res/android"
    xmlns:tools="https://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.xw.firstapp.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:text="动画演示" />

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_margin="5dp"
        android:background="@android:color/black" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_starScaleAnimation"
        android:text="启动缩放动画" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_startTransationAnimation"
        android:text="启动位移动画" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_startRoationAnimation"
        android:text="启动旋转动画" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_startAlphaAnimation"
        android:text="启动透明度动画" />

    <TextView
        android:id="@+id/aty_animation_demo_target"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_gravity="center"
        android:background="@android:color/holo_blue_dark" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:text="差值器" />

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_margin="5dp"
        android:background="@android:color/black" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_bouceInterpolator"
        android:text="测试弹跳差值器" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_overShootInterpolator"
        android:text="测试OverShoot差值器" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_accelerateInterpolator"
        android:text="测试加速差值器" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_decelerateInterpolator"
        android:text="测试减速差值器" />
    
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_margin="5dp"
        android:background="@android:color/black" />
    
	<Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="clk_listener"
        android:text="测试属性动画监听器" />
</LinearLayout>
</ScrollView><Scrol



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: