使用自定义ProgressDialog机器人 [英] Using custom ProgressDialog android

查看:165
本文介绍了使用自定义ProgressDialog机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用自定义的 ProgressDialog ,我能够使它自定义,但我也想删除的上边框或窗口progressDialog 。 在 styles.xml 我定义 customDialog 作为     

I am using custom ProgressDialog in my application, I am able to make it custom but I also want to remove the upper border or window of progressDialog. In styles.xml I define customDialog as

<style name="AppTheme" parent="android:Theme.Light" />

<style name="CustomDialog" parent="@android:style/Theme.Dialog">
    <item name="android:background">#7BC047</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:windowBackground">@null</item>
     <item name="android:windowFrame">@null</item>
</style>

有关删除父窗口我设置 windowBackground 为null,窗框为空,但我以前不工作为了我。 目前我自定义进度对话框看起来像下面给出的图像中

For removing the parent window I am setting windowBackground to null and windowFrame to null but it did't work for me. Currently my custom progress dialog look like that in the image given below

我用这code设置的样式 progressDialog

I am using this code to set the style of progressDialog.

 private void showProgressDialog() {
    progressDialog = new ProgressDialog(this,R.style.CustomDialog);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("Logging in. Please wait.");
    progressDialog.show();
}

所以,帮我对这个问题的任何帮助,应该是真正的AP preciated。

So,help me regarding this issue any help should be really appreciated.

推荐答案

这个答案不解决这个问题说的问题,而是寻求如何实现自定义进度对话框时,这是指向SO的唯一纽带。这就是说,我发现了一个很酷的和易于-use自定义按一定马克西姆Dybarskyi 这个进度对话框中的链接

This answer does not address the problem stated in the question, but when searching for how to implement a custom progress dialog, this is the only link pointing to SO. That said, I found a cool and easy-to -use custom progress dialog by a certain Maksym Dybarskyi on this link.

所有幸得创造者,不是me.Am公正地分享

所有你需要做的就是添加到您的依赖关系:

All you need to do is add this to your dependencies:

dependencies {
...
   compile 'com.github.d-max:spots-dialog:0.4@aar'
}

然后自定义样式:

And then the custom style:

<style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
    <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
    <item name="DialogTitleText">Please Wait</item>
    <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
    <item name="DialogSpotCount">8</item>
</style>

最后,在code做到这一点:

Finally, in your code do this:

private AlertDialog progressDialog;
progressDialog = new SpotsDialog(mContext, R.style.Custom);

//Am using it in an AsyncTask. So in  my onPreExecute, I do this:
public void onPreExecute() {
  super.onPreExecute();
  progressDialog.show();
  ...
 }

//dismiss in onPostExecute
public void onPostExecute(){
   progressDialog.dismiss();
 } 

结果:

输入图像的描述在这里

黄点移动由左到右,你可以改变点的款式数量

这篇关于使用自定义ProgressDialog机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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