4.4.4 Android animation List 实现充能塔的效果
来源:互联网 发布:java教学视频谁的好 编辑:程序博客网 时间:2024/05/16 10:05
0:首相将动画放到mipmap里面去,
1:然后在drawable 里面创建一个rootElement为animation-list的文件drawable_elec,
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android"><item android:drawable="@mipmap/elec01" android:duration="200"/><item android:drawable="@mipmap/elec02" android:duration="200"/><item android:drawable="@mipmap/elec03" android:duration="200"/><item android:drawable="@mipmap/elec04" android:duration="200"/><item android:drawable="@mipmap/elec05" android:duration="200"/></animation-list>
2:布局里面:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ImageView android:layout_marginBottom="100dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/drawable_elec" android:id="@+id/animationList"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:onClick="animationList" android:text="start/stop"/></RelativeLayout>
2:MainActivity 里面:
package tech.androidstudio.animationdemo;import android.graphics.drawable.AnimationDrawable;import android.graphics.drawable.Drawable;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.view.animation.TranslateAnimation;import android.widget.ImageView;import android.widget.TextView;public class MainActivity extends AppCompatActivity implements Animation.AnimationListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void animationList(View view) { ImageView animationList = (ImageView) findViewById(R.id.animationList); AnimationDrawable animationDrawable = (AnimationDrawable)animationList.getDrawable(); if(!animationDrawable.isRunning()) animationDrawable.start(); else animationDrawable.stop(); }}
0 0
- 4.4.4 Android animation List 实现充能塔的效果
- Android animation-list 实现加载动画效果
- android之animation-list+图片实现的粘稠的加载动画效果
- Android Animation动画效果的实现
- Animation动画效果的实现(三)----Animation-list实现逐帧动画
- Animation动画效果的实现
- Animation动画效果的实现
- Animation动画效果的实现
- Animation动画效果的实现
- Animation动画效果的实现
- Animation效果的XML实现
- Animation动画效果的实现
- android 视图动画的使用,Animation重写 实现旋转效果
- android animation动画效果的两种实现方式
- android的动画效果Animation
- 【Animation】Android 用Animation-list实现逐帧动画
- Android frame animation 实现 halo 效果
- android中用animation实现动画效果
- //回溯法搜索八皇后问题
- wdcp面板php版本升级为5.3
- hiho 1269 offer练习赛
- 基数排序
- STM32CubeMx基本说明
- 4.4.4 Android animation List 实现充能塔的效果
- 杭电5053
- 九度OJ 1451-1460(10/10)
- hibernate总结---session与object
- 面向对象个人总结一些易错知识
- [C/C++] 常用算法
- git 总结 -- 本地操作篇
- 一个例子看懂递归
- GridView视图(BaseAdapter)