android image加载中等待动画
- 在布局中添加一个ImageViw和一个EditText。
- <ImageView
- android:id="@+id/loading_imageView_info"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:background="@anim/loading" />
- <EditText
- android:id="@+id/loading_editText_info"
- android:layout_width="0dp"
- android:layout_height="0dp" />
- <pre class="java" name="code"> private ImageView loadingImageView ;
- private EditText loadingEditText;
- private AnimationDrawable anim;</pre>
- loadingImageView =(ImageView)findViewById(R.id.loading_imageView_info);
- loadingEditText =(EditText)findViewById(R.id.loading_editText_info);
- loadingEditText.setInputType(InputType.TYPE_NULL);//屏蔽软键盘
- anim = (AnimationDrawable) loadingImageView.getBackground();
- loadingEditText.setOnFocusChangeListener(editSetOnFocus);
- /**
- * 当输入框获取焦点,则运行动画
- */
- private OnFocusChangeListener editSetOnFocus = new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- // TODO Auto-generated method stub
- anim.start();
- Log.i("text", "执行等待动画。。。。。。。。");
- }
- };
当程序获取到数据一般情况是在hanlder中发送消息通知动画停止,并隐藏当前的控件
- anim.stop();
- loadingImageView.setVisibility(View.GONE);
anim动画在XML中定义,代码如下:
- <?xml version="1.0" encoding="UTF-8"?>
- <animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:duration="150" android:drawable="@drawable/load1" />
- <item android:duration="150" android:drawable="@drawable/load2" />
- <item android:duration="150" android:drawable="@drawable/load3" />
- <item android:duration="150" android:drawable="@drawable/load4" />
- <item android:duration="150" android:drawable="@drawable/load5" />
- <item android:duration="150" android:drawable="@drawable/load6" />
- </animation-list>
android image加载中等待动画的更多相关文章
- css 实现页面加载中等待效果
<!DOCTYPE html> <html> <head> <title>css实现页面加载中,请稍候效果</title> <meta ...
- [TimLinux] CSS 实现加载中的动画
内容来自对<CSS世界>学习代码的理解简化: <!DOCTYPE html> <html> <head> <style> div { pad ...
- android dialog加载中动画效果
//显示动画 dialog = new Dialog(context, R.style.loading); dialog.setContentView(R.layout.loadinglayout); ...
- CSS3实现加载中的动画效果
本篇文章由:http://xinpure.com/css3-implementations-of-loading-an-animation-effect/ Loading 的菊花图形组合的不太好,基本 ...
- css3动画-加载中...
写几个简单的加载中动画吧. 像前面三种都是相当于几个不同的点轮流来播放同一动画:变大变小.css3里面有一个用于尺度变换的方法:scale(x,y):定义 2D 缩放转换,改变元素的宽度和高度. 第四 ...
- Android 菊花加载工具类
先看看实现效果图 1.首先自定义一个类继承系统ProgressDialog /** * Created by hanbao0928 on 2018/11/1. */ public class Dial ...
- adnroid 自定义ProgressDialog加载中
用来记录自己所用到的知识 前两天在做项目的时候发现有时候在访问网络数据的时候由于后台要做的工作较多,给我们返回数据的时间较长,所以老大叫我加了一个加载中的logo图用来提高用户体验. 于是就在网上找了 ...
- Android动画之仿美团加载数据等待时,小人奔跑进度动画对话框(附顺丰快递员奔跑效果)
Android动画之仿美团加载数据等待时,小人奔跑进度动画对话框(附顺丰快递员奔跑效果) 首句依然是那句老话,你懂得! finddreams :(http://blog.csdn.net/finddr ...
- 漂亮的Android加载中动画:AVLoadingIndicatorView
AVLoadingIndicatorView 包含一组漂亮的Android加载中动画. IOS版本:here. 示例 Download Apk 用法 步骤1 Add dependencies in b ...
随机推荐
- SharePoint 2010/2013: List view Lookup threshold uncovered
SharePoint with Large lists is common scenario in any Sharepoint deployment. While there are Several ...
- CSOM中如何取到managed metadata类型字段的类型信息
Field.fieldTypeKind返回的是Invalid [解决方法] There is no "Metadata" type of field in the SP.Field ...
- junit mockito
package com.zendaimoney.util; import static org.mockito.Mockito.*;import static org.junit.Assert.*;i ...
- Android Studio中关于9-patch格式图片的编译错误
最近在编译Android Studio开发的项目中在使用了9宫图后出现了编译错误,尝试了多种方法未能解决,最后仔细查看出错的日志发现,居然是图片的原因,图片中包含有alpah通道所以在执行app:me ...
- phpMyadmin安装极简教程[下载,解压,登录]
1.下载一个压缩包,例如: 2. 解压到web根目录并重命名为phpmyadmin 3.在浏览器输入http://localhost/phpmyadmin就可以看到登陆界面了,登陆之后,数据库,表的增 ...
- ZH奶酪:如何在Ubuntu上安装Java/管理多个JAVA/设置JAVA_HOME
0.简介 Java的地位及重要性,大家都懂的,很多软件都依赖于jdk,在Ubuntu上安装Java的选择有很多,openJDK,Oracle Jdk... 1.安装默认 JRE/JDK(可选) 这是最 ...
- HOW TO: Synchronize changes when completing a P2V or V2V with VMware vCenter Converter Standalone 5.1
http://www.experts-exchange.com/Software/VMWare/A_11489-HOW-TO-Synchronize-changes-when-completing-a ...
- Linux中进程与线程及CPU使用率查询
一.进程查询: ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' 说明:PCPU是Cpu使用率,8核最多是800. 或者 ps -aux 二.线 ...
- Android开之在非UI线程中更新UI
当在非UI线程中更新UI(程序界面)时会出现例如以下图所看到的的异常: 那怎样才干在非UI线程中更细UI呢? 方法有非常多种.在这里主要介绍三种: 第一种:调用主线程mHandler的post(Run ...
- 【BI】OLTP与OLAP的区别
概念 OLTP:联机事务处理(On-Line transaction Processing) OLAP:联机分析处理(On-Line Analytical Processing) (1)OLTP是传统 ...