自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
来源:互联网 发布:剧本编写软件 编辑:程序博客网 时间:2024/04/24 13:13
自定义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:点击打开链接
0 0
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- Android自定义类似ProgressDialog效果加载动画
- 自定义ProgressDialog加载图片
- 安卓ProgressDialog实现自定义Diallog加载动画
- Android加载动画 旋转动画 、帧动画
- 旋转动画加载, 旋转角度
- 自定义加载动画的效果
- Spin.js旋转的加载动画
- AnimationDrawable 实现正在加载的旋转动画
- iOS中旋转加载动画的实现
- iOS中旋转加载动画的实现
- iOS中旋转加载动画的实现
- 使用旋转动画和帧动画实现自定义ProgressDialog
- 自定义扇形进度条、异步加载网络图片、Activity疯狂旋转动画
- 自定义加载进度动画
- 自定义加载动画
- 自定义Dialog加载动画
- QQ浏览器X5内核问题汇总
- Core Animation学习笔记
- Android Studio导入第三方类库的方法,在android Studio 1.2.11中
- 64位操作系统在本地安装oracle数据库的情况下,怎么使用plsql连接远程或者本地的oracle数据
- 近期学习任务
- 自定义progressdialog加载动画,这里还有旋转的加载条,美团,多个图片动画
- 纯代码项目创建
- 以太网帧结构详解
- 这是成长吗?
- Core Foundation 框架
- JS中Math之random,round,ceil,floor的用法总结
- TI C6678 DSP与PC 的以太网通信实现
- JDBC工具类
- hdoj1428_漫步校园(dp)