我有一个活动,显示在对话框中:

为了删除边框和圆角,我试过这个:
<resources>
<style name="ActivityDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@null</item>
<item name="android:windowFrame">@null</item>
</style>
Run Code Online (Sandbox Code Playgroud)
边界消失了,但遗憾的是对话框周围的边缘.
我ProgressDialog在我的应用程序中使用自定义,我能够自定义,但我也想删除上边框或窗口progressDialog.在styles.xml我定义customDialog为
<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>
Run Code Online (Sandbox Code Playgroud)
为了删除父窗口我设置windowBackground为null和windowFramenull但它不适合我.目前,我的自定义进度对话框在下面给出的图像中看起来像
我正在使用此代码来设置样式progressDialog.
private void showProgressDialog() {
progressDialog = new ProgressDialog(this,R.style.CustomDialog);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setMessage("Logging in. Please wait.");
progressDialog.show();
}
Run Code Online (Sandbox Code Playgroud)
所以,帮助我解决这个问题应该非常感谢任何帮助.
我使用以下代码更改Progress Dialog的背景.但是外框的颜色也如下所示.我想只在对话框内进行更改.
<style name="StyledDialog" parent="@android:style/Theme.Panel">
<item name="android:background">#083044</item>
</style>
Run Code Online (Sandbox Code Playgroud)

根据此问题给出的答案更改ProgressDialog的背景
<style name="StyledDialog" parent="@android:style/Theme.Dialog">
<item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
<item name="android:textColorPrimary">#000000</item>
</style>
<style name="CustomAlertDialogStyle">
<item name="android:bottomBright">@color/background</item>
<item name="android:bottomDark">@color/background</item>
<item name="android:bottomMedium">@color/background</item>
<item name="android:centerBright">@color/background</item>
<item name="android:centerDark">@color/background</item>
<item name="android:centerMedium">@color/background</item>
<item name="android:fullBright">@color/background</item>
<item name="android:fullDark">@color/background</item>
<item name="android:topBright">@color/background</item>
<item name="android:topDark">@color/background</item>
</style>
Run Code Online (Sandbox Code Playgroud)
此代码提供完美的背景颜色.但是,因为对话颜色和活动的背景颜色是相同的.它看起来像透明,没有边框.我和以前一样想要一些边框.

那
我试过实现它.
mProgressDialog = new ProgressDialog(this);
mProgressDialog.getWindow().setContentView(R.layout.footcloth);
mProgressDialog.setMessage(Constants.PROGRESS_DIALOG_MESSAGE);
mProgressDialog.show();
Run Code Online (Sandbox Code Playgroud)
但是这个代码抛出异常
java.lang.RuntimeException: Unable to start activity ComponentInfo{im.anticafe.anticafeim/im.anticafe.anticafeim.activities.HomeActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Run Code Online (Sandbox Code Playgroud)
此代码在活动BottomBarActivity中实现
abstract public class BottomBarActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = "bottomBarActivity";
private int mWidth;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mProgressDialog = new ProgressDialog(this);
mProgressDialog.getWindow().setContentView(R.layout.footcloth);
mProgressDialog.setMessage(Constants.PROGRESS_DIALOG_MESSAGE);
mProgressDialog.show();
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
而这项活动正在其他方面扩展.所以,请帮我解决我的问题,谢谢)