帧动画
来源:互联网 发布:php获取服务器信息 编辑:程序博客网 时间:2024/06/05 00:29
帧动画 一帧一帧的实现,联系起来就是动漫,多用于游戏,手机桌面的大部分图片都是用的补间动画,需要设置显示一个帧的时间
首先建立drawable文件夹,在里面创建fragm的xml文件,如下设置
<!-- 配置文件中定义帧动画的执行过程
每隔多久换什么图片 -->
<item android:duration="150" android:drawable="@drawable/p1"/>
<item android:duration="150" android:drawable="@drawable/p2"/>
<item android:duration="150" android:drawable="@drawable/p3"/>
<item android:duration="150" android:drawable="@drawable/p4"/>
<item android:duration="150" android:drawable="@drawable/p5"/>
<item android:duration="150" android:drawable="@drawable/p6"/>
在activity的代码,在textview中显示图片
private void setViews() {
textView = (TextView) findViewById(R.id.textView);}
public void doClick(View view){
switch (view.getId()) {
case R.id.button1:
startFrameAnimation();
break;
}
}
//启动帧动画
private void startFrameAnimation() {
//配置文件方式
AnimationDrawable ad=(AnimationDrawable)
textView.getBackground();
//使用代码给animationDrawable添加帧
ad.addFrame(getResources().getDrawable(R.drawable.p6), 150);
ad.addFrame(getResources().getDrawable(R.drawable.p5), 150);
ad.addFrame(getResources().getDrawable(R.drawable.p4), 150);
ad.addFrame(getResources().getDrawable(R.drawable.p3), 150);
ad.addFrame(getResources().getDrawable(R.drawable.p2), 150);
ad.addFrame(getResources().getDrawable(R.drawable.p1), 150);
//动起来
ad.start();
}
0 0
- 动画__帧动画
- 转场动画 帧动画
- 动画 AnimationDrawable 帧动画
- 动画----帧动画
- 安卓补间动画、帧动画
- Android动画-帧动画
- Android动画--帧动画
- egret_gif动画(帧动画)
- android动画 -- 帧动画 补间动画
- 属性动画,补间动画,帧动画
- View动画、帧动画、属性动画
- Android动画-帧动画&补间动画
- Android加载动画 旋转动画 、帧动画
- 帧动画、补间动画、属性动画
- 动画(过渡动画、关键帧动画)
- Android动画-帧动画-属性动画
- 帧动画&补间动画&属性动画
- 安卓 动画帧动画基础动画
- UOJ25——IOI2014Wall
- Java NIO原理图文分析及代码实现
- 【opencv】鱼眼图像畸变校正——双经度法
- iOS在沙盒Documents中创建文件夹以及获取沙盒路径
- Android TextView(EditView)文字底部或者中间 加横线
- 帧动画
- date通过json传递序列化后的前台转换
- echart 默认选中legend及其选中事件
- 详解Sqoop的架构和安装部署
- ThinkPHP关联模型操作
- maven Dependency介绍
- spark应用程序的运行架构
- linux lvm 简介之一 创建 vg,lv,fs mount
- iOS开发——响应链(Responder Chain)的深入理解和代码示例