如何申请定制微调形象进度在android的对话框 [英] How to apply custom spinner image to progress dialog in android

查看:113
本文介绍了如何申请定制微调形象进度在android的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我特林应用自定义微调图像进步dialod android的我为此目的而使用.gif文件,而我应用它,通过这个code,

hi i tring to apply custom spinner image to progress dialod in android i use a .gif file for this purpose,and i apply it through this code,

dialog = new ProgressDialog(BackupRestoreActivityContext);    
dialog.setCancelable(true);    
dialog.setIcon(resId);    
dialog.setTitle(title);    
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);    
dialog.setIndeterminate(true);
dialog.setIndeterminateDrawable(BackupRestoreActivityContext.getResources().getDrawable(R.drawable.bar));    
dialog.show();

通过这个code微调图像改为bar.gif,但没有转动, 请您帮我什么是错,由于这方面的帮助是很大的AP preciated。

through this code Spinner image changed to bar.gif but it is not spinning, please kindly help me whats wrong with this,thanks any help in this regard is greatly appreciated.

推荐答案

在Android上,gif动画不能在ImageView的工作。你需要给他们发挥的电影如由样品ApiDemos。

In Android, animated gif don't work in ImageView. You need to play them as movies as shown by the sample ApiDemos.

但你可以爆炸的GIF在multple文件,并创建一个动画的ressource文件。 动画文件是描述可拉伸的清单,以显示与每帧的持续时间(或变换来适用,如果可以使用它们)的xml文件。 你可以阅读在这里的官方文档的详细信息: <一href="http://developer.android.com/guide/topics/resources/animation-resource.html#Frame">http://developer.android.com/guide/topics/resources/animation-resource.html#Frame

But you can explode your gif in multple files and create an animation ressource file. An animation file is an xml file describing the list of drawable to display and the duration of each frame (or the transformations to apply if you can use them). You can read the details in the official documentation here: http://developer.android.com/guide/topics/resources/animation-resource.html#Frame

那么这绘制应该在ProgressDialog很好地工作。

This drawable should then work nicely in your ProgressDialog

这篇关于如何申请定制微调形象进度在android的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆