创建progressDialog仅与离心器(在中间) [英] Create a progressDialog only with the spinner (in the middle)

查看:158
本文介绍了创建progressDialog仅与离心器(在中间)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要仅与离心器和不带盒(或至少具有较小框和中间图像)创建一个progressDialog

I need to create a progressDialog only with the spinner and without the box (or at least with a smaller box and the image in the middle).

我不希望一个微调添加到我的.xml(布局文件)加载微调。

I don't want to add a spinner to my .xml (layout file) to load the spinner.

有没有办法做到这一点?谢谢!

Is there any way to accomplish this? Thanks!

推荐答案

试试这个方法:

pd = new ProgressDialog(Login.this,R.style.MyTheme);
pd.setCancelable(false);
pd.setProgressStyle(android.R.style.Widget_ProgressBar_Small);
pd.show();

而在价值创造的主题 \ styles.xml

And create Theme in values\styles.xml

 <style name="MyTheme" parent="android:Theme.Holo.Dialog">
    <item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
    <item name="android:windowBackground">@color/transparent</item>
    <item name="android:textColorPrimary">#FFFFFF</item>
     <item name="android:backgroundDimEnabled">false</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:textStyle">normal</item>
    <item name="android:textSize">12sp</item>
</style>

和也值添加此主题 \ styles.xml

And also add this Theme in values\styles.xml

 <style name="CustomAlertDialogStyle">
    <item name="android:bottomBright">@color/transparent</item>
    <item name="android:bottomDark">@color/transparent</item>
    <item name="android:bottomMedium">@color/transparent</item>
    <item name="android:centerBright">@color/transparent</item>
    <item name="android:centerDark">@color/transparent</item>
    <item name="android:centerMedium">@color/transparent</item>
    <item name="android:fullBright">@color/transparent</item>
    <item name="android:fullDark">@color/transparent</item>
    <item name="android:topBright">@color/transparent</item>
    <item name="android:topDark">@color/transparent</item>
</style>

和增加值\ colors.xml

<color name="transparent">#00000000</color>

这篇关于创建progressDialog仅与离心器(在中间)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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