簡體   English   中英

如何刪除自定義進度對話框的背景

[英]how to remove a background of custom progress dialog

iam制作自定義進度對話框

我的自定義樣式代碼是

 <style name="CustomDialog" parent="@android:style/Theme.Dialog">
 <item name="android:background">#000000</item>
 <item name="android:textColor">#FFFFFF</item>
 </style>

而我的Java代碼是。

    pDialog = new ProgressDialog(context,R.style.CustomDialog);
    pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pDialog.setMessage("Processing");

    pDialog.getWindow().setBackgroundDrawable(newColorDrawable(android.graphics.Color.TRANSPARENT));
    pDialog.setCancelable(false);
    pDialog.show();

現在我如何在進度對話框中刪除背景色,同樣是圖像鏈接正在使用自定義ProgressDialog android

在您的styles.xml中:

<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:windowNoTitle">true</item>
</style>

在您的代碼中:

pDialog = new ProgressDialog(context,R.style.CustomDialogTheme);

只需按照您的風格使用

<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

學分SC

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM