package comn.qm;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
/**
* 恰面网
* www.qiamian.com
* @author 轻描淡写
* 3 z种自定义 Loading
*/
public class LoadDemo extends Activity {
/** Called when the activity is first created. */
// private ImageButton ib;
// private ImageView iv;
private Animation animation;
private final int STOP_ROTATION_MSG = 1;
// private ProgressBar pb;
// private ImageView wLoading;
Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == STOP_ROTATION_MSG) {
// iv.clearAnimation();
// iv.setVisibility(View.INVISIBLE);
// ib.setEnabled(true);
}
super.handleMessage(msg);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// 欢迎界面加载动画
// wLoading = (ImageView) findViewById(R.id.welcomeLoading);
// ib = (ImageButton) findViewById(R.id.locateBtn);
// iv = (ImageView) findViewById(R.id.locateImageView);
// iv.setVisibility(View.INVISIBLE);
// ib.setOnClickListener(mClick);
// pb = (ProgressBar) findViewById(R.id.goLoad);
// pb.setVisibility()
animation = AnimationUtils.loadAnimation(this, R.anim.rotate);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
// 进入就加载不放在 onCreate 方法内
// wLoading.setBackgroundResource(R.drawable.spinner_small);
// AnimationDrawable ad=(AnimationDrawable) wLoading.getBackground();
// ad.start();
super.onWindowFocusChanged(hasFocus);
}
public final Button.OnClickListener mClick = new Button.OnClickListener() {
public void onClick(View v) {
// ib.setEnabled(false);
// iv.setVisibility(View.VISIBLE);
// iv.startAnimation(animation);
// new Thread(new MyThread()).start();
}
};
class MyThread implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
while (true) {
try {
Thread.sleep(5000);
Message message = new Message();
message.what = STOP_ROTATION_MSG;
handler.sendMessage(message);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
android开发loading实例
共43个文件
png:13个
class:11个
xml:9个
4星 · 超过85%的资源 需积分: 34 73 下载量 5 浏览量
2012-07-05
20:02:19
上传
评论
收藏 78KB RAR 举报
温馨提示
本demo写的是一个简单的android开发中实现的类似于web中的loading效果的例子,有助于大家的学习!
资源推荐
资源详情
资源评论
收起资源包目录
Loading.rar (43个子文件)
LoadDemo
AndroidManifest.xml 668B
res
anim
rotate.xml 325B
layout
dialog.xml 1KB
main.xml 2KB
my.xml 1KB
drawable
spinner_small_02_black.png 926B
spinner_small_01_black.png 926B
spinner_small_06_black.png 922B
locating.png 2KB
locate_ok.png 3KB
spinner_small_07_black.png 900B
locate_ok_btn.xml 435B
spinner_small_05_black.png 929B
locating_bg.png 1KB
spinner_small_03_black.png 911B
spinner_small.xml 869B
icon.png 3KB
spinner_small_08_black.png 921B
spinner_small_04_black.png 911B
locate_down.png 2KB
load_progressbar_style.xml 546B
values
strings.xml 167B
proguard.cfg 1KB
src
comn
qm
LoadDemo.java 3KB
bin
comn
qm
LoadDemo$MyThread.class 995B
LoadDemo.class 1KB
LoadDemo$1.class 644B
R.class 489B
LoadDemo$2.class 649B
R$anim.class 357B
R$layout.class 417B
R$attr.class 307B
R$id.class 632B
R$string.class 394B
R$drawable.class 990B
classes.dex 5KB
LoadDemo.apk 34KB
resources.ap_ 29KB
.classpath 280B
assets
default.properties 362B
.settings
org.eclipse.core.resources.prefs 105B
.project 844B
gen
comn
qm
R.java 2KB
共 43 条
- 1
chutong452
- 粉丝: 2
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页