怎么让progressbar不转动

今天在做progressdialog的时候,百度问题的时候,看到不少人在问,怎么让progressbar不转动,我去,嘛情况?我的现在的就不转,我正想找怎么让他转呢。下面做一下笔记:(我感觉这个也可以当做progressbar不转动的解决方案的。)


1.想让不转:

ProgressDialog mDialog1 = new ProgressDialog(ProgressbarTest2Activity.this, R.style.mcustomprogressdialog);
		mDialog1.show();
		mDialog1.setContentView(R.layout.customprogressdialog);
customprogressdialog.xml文件里面就是一个imageview,我就不贴代码了。imageview的src是一张图片,这个图片是自己想要显示的图片。

2.想让转,就需要加上几句话

ProgressDialog mDialog1 = new ProgressDialog(ProgressbarTest2Activity.this, R.style.CustomProgressDialog);
		mDialog1.show();
		mDialog1.setContentView(R.layout.customprogressdialog);
		
		ImageView imageView = (ImageView) mDialog1.findViewById(R.id.loadingImageView);
		AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
		animationDrawable.start();

xml文件和上面的一样。



注意:

1.show()要写在setcontentview()的上面,不让会报“requestFeature() must be called before adding content”错误。

好了,笔记完毕!!



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值