Yas*_*nth 7 android progressdialog android-progressbar
我动态地在asynctask中创建了progressdialog.我为我的应用程序使用自定义样式.当我这样做,我的progressdialog风格改为白色我需要我的黑色默认风格与白色文本.
我的java文件:
class LoginTask extends AsyncTask<Void, Void, Void> {
private final ProgressDialog dialog = new ProgressDialog(Login.this);
@Override
protected void onPreExecute() {
this.dialog.setMessage("Logging in...");
this.dialog.show();
}
// my prog
@Override
protected void onPostExecute(Void result) {
if (this.dialog.isShowing()) {
this.dialog.dismiss();
}}
Run Code Online (Sandbox Code Playgroud)
我的style.xml:
<style name="AppBaseTheme" parent="android:Theme.Light">
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowBackground">@drawable/blue</item>
<item name="android:textColor">@color/white</item>
<item name="android:editTextColor">@color/white</item>
<item name="android:buttonStyle">@android:style/Widget.Holo.Button</item>
<item name="android:dropDownSpinnerStyle">@android:style/Widget.Holo.Spinner</item>
<item name="android:textAppearanceButton">@android:style/TextAppearance.Widget.Button</item>
<item name="android:progressBarStyle">@style/ProgressBar</item>
</style>
<style name="ProgressBar" parent="@style/android:Theme.Holo">
<item name="android:textColor">@color/red</item>
<item name="android:background">@color/green</item>
</style>
Run Code Online (Sandbox Code Playgroud)
Ham*_*atu 11
更改以下行以style通过您的构造函数...
private final ProgressDialog dialog = new ProgressDialog(Login.this);
Run Code Online (Sandbox Code Playgroud)
对...
private final ProgressDialog dialog = new ProgressDialog(Login.this, R.style.ProgressBar);
Run Code Online (Sandbox Code Playgroud)
更新:
我只是改变style如下...并为其工作.
<style name="ProgressBar" parent="@style/android:Theme.Holo">
<item name="android:textColor">#FFFFFF</item>
<item name="android:background">#000000</item>
</style>
Run Code Online (Sandbox Code Playgroud)