Yashwanth
Yashwanth

Reputation: 962

Progressbarstyle not working in android

I'm trying my own theme for my app and I changed some of the widgets using default style. I need the progress bar style as default.

when I used this code for spinner and button its working

<style name="AppTheme" parent="AppBaseTheme">
    <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>
</style>

But when I try for progressbar its not working

    <item name="android:progressBarStyle">@android:style/Widget.Holo.ProgressBar</item>

My progress bar code code in asynctask created dynamically

class play extends AsyncTask<Void, Void, Void> {

    private final ProgressDialog dialog = new ProgressDialog(PropertyTaxpay.this);

    @Override
    protected void onPreExecute() {
        this.dialog.setMessage("Loading data");
        this.dialog.show();
    }

    @Override
    protected Void doInBackground(Void... unused) {
    //my code

 }


    @Override
    protected void onPostExecute(Void result) {
        if (this.dialog.isShowing()) {
        this.dialog.dismiss();
}

What I get:

enter image description here

But I need with black background. Like the one in holo theme.

like this:

enter image description here

Upvotes: 1

Views: 1866

Answers (1)

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132982

Using code you can set @android:style/Widget.Holo.ProgressBar style for ProgressDialog as:

private final ProgressDialog dialog = new 
    ProgressDialog(PropertyTaxpay.this,android.R.style.Widget_Holo_ProgressBar);

or Using xml do it as:

In styles.xml add:

<style name="ProgressBar" parent="@android:style/Widget.Holo.ProgressBar">
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:background">#000000</item>
</style>

and in Code pass your own style as second parameter of ProgressDialog constructor :

private final ProgressDialog dialog = new 
    ProgressDialog(PropertyTaxpay.this,R.style.ProgressBar);

Upvotes: 3

Related Questions