自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
来源:互联网 发布:京东数据监测 编辑:程序博客网 时间:2024/04/26 04:53
自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
下载Demo:http://download.csdn.net/detail/menglele1314/8775497
public class MainActivity extends Activity {
private Button submit;
private AnimationDrawable fightnimation, fightnimationab;
private ImageView pb, net, netab;
private Dialog mLoading;
private Animation animation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
submit = (Button) findViewById(R.id.btn_login_submit);
pb = (ImageView) findViewById(R.id.iv_failure);
animation = AnimationUtils.loadAnimation(MainActivity.this,
R.anim.cirle);
animation.setInterpolator(new LinearInterpolator());
netab = (ImageView) findViewById(R.id.iv_netab);
netab.setBackgroundResource(R.anim.fight);
fightnimationab = (AnimationDrawable) netab.getBackground();
net = (ImageView) findViewById(R.id.iv_net);
net.setBackgroundResource(R.anim.loading);
fightnimation = (AnimationDrawable) net.getBackground();
submit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
mLoading = createLoadingDialog(MainActivity.this);
mLoading.show();
// mLoading.dismiss();
pb.startAnimation(animation);
fightnimationab.start();
fightnimation.start();
}
});
}
/**
* 得到自定义的progressDialog
*
* @param context
* @return
*/
public static Dialog createLoadingDialog(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.layout_loading_dialog, null); // 得到加载view
LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view); // 加载布局
ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img);
Animation animation = AnimationUtils.loadAnimation(
context, R.anim.cirle); // 加载动画
animation.setInterpolator(new LinearInterpolator());
spaceshipImage.startAnimation(animation); // 使用ImageView显示动画
Dialog loadingDialog = new Dialog(context, R.style.loading_dialog); // 创建自定义样式dialog
// loadingDialog.setCancelable(false);// 不可以用"返回键"取消
loadingDialog.setContentView(layout, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
return loadingDialog;
}
}
下载Demo:点击打开链接
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- Android自定义类似ProgressDialog效果加载动画
- 自定义ProgressDialog加载图片
- 安卓ProgressDialog实现自定义Diallog加载动画
- Android加载动画 旋转动画 、帧动画
- 旋转动画加载, 旋转角度
- 自定义加载动画的效果
- Spin.js旋转的加载动画
- AnimationDrawable 实现正在加载的旋转动画
- iOS中旋转加载动画的实现
- iOS中旋转加载动画的实现
- iOS中旋转加载动画的实现
- 使用旋转动画和帧动画实现自定义ProgressDialog
- 自定义扇形进度条、异步加载网络图片、Activity疯狂旋转动画
- 自定义加载进度动画
- 自定义加载动画
- 自定义Dialog加载动画
- Android DEX安全攻防战
- Codeforces Round #326 (Div. 2)
- Mac下 android 模拟器/真机 host修改
- orign绘制双排Stack Column
- Boost.asio 一些注意事项
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- linux 下的socket 客户端开发
- Android多媒体编程——图片的大小计算
- C语言基础学习——printf函数
- 组件与.NET互操作
- HTML基础(登录按钮如何改样式)
- Python二维码生成库qrcode安装和使用示例
- 2015年浪潮面试题
- 算法的力量