我試圖使我的對話框的背景透明。我希望進度條顯示在我的活動前面。不幸的是,背景始終保持白色。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@ id/loading_cont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:backgroundTint="#00000000"
android:background="@android:color/transparent"
>
<RelativeLayout
android:id="@ id/loading_dialog_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="#00000000"
android:background="@android:color/transparent"
>
<ProgressBar
android:id="@ id/login_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true" >
</ProgressBar>
</RelativeLayout>
uj5u.com熱心網友回復:
新建一個Drawable Resource file名為transparent.xml.
透明檔案
<shape
android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
</shape>
現在設定 android:background="@drawable/transparent"
uj5u.com熱心網友回復:
在您初始化對話框的位置添加此代碼
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
或者您也可以添加此代碼
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/403854.html
標籤:
上一篇:更改操作欄高度
