Android XML file之animation-list
来源:互联网 发布:ck解析源码 编辑:程序博客网 时间:2024/05/21 12:42
1.animation-list
帧布局文件(顺序显示动画和倒序显示动画)(其中oneshot代表着是否只展示一遍,false会不停的循环播发动画)
在drawable中创建animation_list.xml文件
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@mipmap/ic_launcher1" android:duration="150"/> <item android:drawable="@mipmap/ic_launcher2" android:duration="150"/> <item android:drawable="@mipmap/ic_launcher3" android:duration="150"/> <item android:drawable="@mipmap/ic_launcher4" android:duration="150"/> <item android:drawable="@mipmap/ic_launcher5" android:duration="150"/></animation-list>
<LinearLayout 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" android:orientation="vertical" > <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/animation_list"/> <Button android:id="@+id/btn_start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="开始动画"/> <Button android:id="@+id/btn_end" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="停止动画"/></LinearLayout>
Activity:
public class Secondctivity extends AppCompatActivity implements View.OnClickListener { private ImageView imageView; private Button btn_stsart,btn_end; private AnimationDrawable animationDrawable; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_secondctivity); imageView = (ImageView) findViewById(R.id.imageView); btn_stsart = (Button) findViewById(R.id.btn_start); btn_end = (Button) findViewById(R.id.btn_end); btn_stsart.setOnClickListener(this); btn_end.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.btn_start://开始动画 imageView.setImageResource(R.drawable.animation_list); animationDrawable = (AnimationDrawable) imageView.getDrawable(); animationDrawable.start(); break; case R.id.btn_end://结束动画 animationDrawable = (AnimationDrawable) imageView.getDrawable(); animationDrawable.stop(); break; } }}
0 0
- Android XML file之animation-list
- android XML file之ClipDrawable
- android animation-list 使用
- Android animation-list 逐帧
- animation 之xml控制
- android animation xml配置
- android animation xml
- Android之Animation-list实现逐帧动画
- Android动画之animation-list实现逐帧动画
- Android Animation之frame animation
- web.xml之welcome-file-list、error-page
- Android xml 效果之 State List Drawable
- Android animation xml 配置说明
- Android之Animation
- Android学习之Animation
- android之Animation Interpolator
- Android之Animation
- Android之Animation
- 10.php桥接模式
- jdbc连接Microsoft SQL Server 2014
- Quartz2D简单介绍
- 大尺寸网页在小分辨率显示器上或小窗口上的居中显示
- cocos2dx 绽开效果
- Android XML file之animation-list
- 【android】仿知乎ScrollView滚动改变标题栏透明度
- 机器学习(一)——线性回归(Linear Regression)
- android shape讲解小全及例子
- 欢迎使用CSDN-markdown编辑器
- python自动下载图片
- Android测试
- cocos2d-x中3D游戏的制作-相机的使用教程
- iOS调用系统功能