zoukankan      html  css  js  c++  java
  • Android中帧动画的创建

    帧动画,实质上就是快速播放多张连接效果的图片,现在一般可用于下拉刷新时候的headView

    实现步骤:

      1、首先应该准备一组连接效果的图片

      2、在res>drawable目录下创建xml文件,将图片对象添加到集合naimation-list

    <?xml version="1.0" encoding="utf-8"?>
        <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
            android:oneshot="false">
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_01"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_02"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_03"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_04"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_05"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_06"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_07"
                android:duration="200"/>
            <item android:drawable="@mipmap/bga_refresh_mt_refreshing_08"
                android:duration="200"/>
        </animation-list>

        注意: android:oneshot="false" 设置false表示可以循环播放 设置true表示只播放一次

      3、加载进ImageView背景进行播放

    final ImageView image= (ImageView) findViewById(R.id.image);
        image.setBackground(R.drawable.refresh);
        image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AnimationDrawable animationDrawable= (AnimationDrawable) image.getBackground();
                animationDrawable.start();// 开启动画
            }
        });
  • 相关阅读:
    MongoDB 数据类型
    linux 查看网卡流量:nload
    Linux 抓包工具:tcpdump
    python 合并列表 从大到小排序
    MongoDB的客户端管理工具--nosqlbooster 连接MongoDB服务器
    MongoDB 用户管理
    MongoDB 数据库操作
    MongoDB与关系型数据库 区别
    MongoDB 新建数据库和集合 查询集合
    POJ 1491
  • 原文地址:https://www.cnblogs.com/yegong0214/p/6277750.html
Copyright © 2011-2022 走看看