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 ...
随机推荐
- 基于浏览器的开源“管理+开发”工具,Pivotal MySQL*Web正式上线!
基于浏览器的开源“管理+开发”工具,Pivotal MySQL*Web正式上线! https://www.sohu.com/a/168292858_747818 https://github.com/ ...
- OpenWRT下实现Portal认证(WEB认证)
首先简单介绍一下什么是Portal认证,Portal认证,通常也会叫Web认证,未认证用户上网时,设备强制用户登录到特定站点,用户可以免费访问其中的服务.当用户需要使用互联网中的其它信息时,必须在门户 ...
- python连接mysql实例分享_python
示例一 #coding=UTF-8 import sys import MySQLdb import time reload(sys) sys.setdefaultencoding('utf-8') ...
- C# .Net计算函数执行的时间
C#计算函数执行的时间 protected void StopwatchTest() { System.Diagnostics.Stopwatch stopwatch = new System.Dia ...
- 两种解决IE6不支持固定定位的方法
有两种让IE6支持position:fixed1.用CSS执行表达式 *{margin:0;padding:0;} * html,* html body{ background-image:url(a ...
- JDK5.0特性-线程 Callable和Future
来自:http://www.cnblogs.com/taven/archive/2011/12/17/2291466.html import java.util.concurrent.Callable ...
- sell 项目 订单详情表 设计 及 创建
1.数据库设计 2.订单详情表 创建 /** * 订单详情表 */ create table `order_detail` ( `detail_id` varchar(32) not null, `o ...
- [转]jquery设置select选中,赋值等操作
一.基础取值问题 例如<select class="selector"></select> 1.设置value为pxx的项选中 $(".selec ...
- WCF 客户端 BasicHttpBinding 兼容 HTTPS 和 HTTP
背景:全站HTTPS的时代来了 全站HTTPS,请参考:http://www.cnblogs.com/bugly/p/5075909.html 1. 设置BasicHttpBinding的BasicH ...
- javascript用正則表達式检測username的合法性
在用户登录.用户注冊时经常须要对username如邮箱.手机号进行校验,一般经常使用表达式. 以下整理对邮箱和手机号的表达式校验: function checkUser(){ var userName ...