gpt4 book ai didi

android - 没有填充的进度对话框

转载 作者:太空宇宙 更新时间:2023-11-03 12:50:07 25 4
gpt4 key购买 nike

我在 Fragment 中使用一个简单的进度对话框生成器方法:

public void showProgressDialog(int messageId){
String message = getString(messageId);
mProgressDialog = ProgressDialog.show(this.getActivity(), "", message, true);
}

我的进度对话框是这样的,没有正常的填充: Progress Dialog

我应该怎么做才能在我的进度条周围设置默认填充?

编辑:添加 themes.xml 文件

<resources xmlns:tools="http://schemas.android.com/tools">

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
</style>

<style name="AppTheme" parent="AppBaseTheme">

<item name="android:textColorPrimary">@android:color/white</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>

<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

<!-- Toolbar Theme / Apply white arrow -->
<item name="colorControlNormal">@android:color/white</item>
<item name="actionBarTheme">@style/AppTheme.ActionBarTheme</item>

<!-- Material Theme -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/status_bar_color</item>
<item name="colorAccent">@color/accent_color</item>

<item name="android:navigationBarColor" tools:targetApi="21">@color/navigationBarColor</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>

</style>

<style name="AppTheme.ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<!-- White arrow -->
<item name="colorControlNormal">@android:color/white</item>
</style>

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/drawerArrowColor</item>
</style>
</resources>

This class was deprecated in API level 26. ProgressDialog is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like ProgressBar, which can be embedded in your app's UI. Alternatively, you can use a notification to inform the user of the task's progress. For more details Link

最佳答案

这是我的解决方法,为对话框创建一个新的主题。希望对您有所帮助!

   <style name="ProgressDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:fitsSystemWindows">false</item>
<item name="android:clipToPadding">false</item>
</style>

ProgressDialog progressDialog = new ProgressDialog(context, R.style.ProgressDialogTheme);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setMessage(content);
progressDialog.show();

关于android - 没有填充的进度对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33382534/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com