Custom Progress Dialog Animation

android, android-emulator, android-layout, android-widget

Solution

import android.app.ProgressDialog;
import android.content.Context;
import android.view.animation.Animation;

public class MyProgressDialog extends ProgressDialog {

    public MyProgressDialog(Context context) {
        super(context,R.style.NewDialog);

        // TODO Auto-generated constructor stub
    }

}

//RESOURCE STYLE FILE res->values->mydialog.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <style name="NewDialog" parent="@android:style/Theme.Dialog">

    <item name="android:windowFrame">@null</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowTitleStyle">@null</item>
    <item name="android:colorBackground">#ffffff</item>
    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
    <item name="android:backgroundDimEnabled">true</item>
    <item name="android:width">600dip</item>
    <item name="android:height">100dip</item>
     <item name="android:textColor">#FF0000</item>

</style>
</resources>

//AND USE THIS CODE ANYWHERE IN YOUR APPLICATION TO GET CUSTOM PROGRESS DIALOG

MyProgressDialog pd = new MyProgressDialog(YouActivity.this);
pd.setMessage("Loading. Please wait...");
pd.show();

Well there isn't any difference in your code and mine as I have run your code just to test whether you are experiencing any problem or not but still I am posting for you so that you can sought out the problem.

Thanks :)

Problem

I am working on `Custom Progress Dialog`. I've set its style like done in this SO question Positionning the spinning wheel in a custom progress dialog My progress dialog is showing no animation at all. When I changed the `background` to `black` then it was only showing a black box. I want my progress dialog to animate. In activity I am doing something like this ``` public MyProgressDialog(Context context) { super(context, R.style.NewDialog); } ``` and the NewDialog is as: ``` <style name="NewDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowIsFloating">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowTitleStyle">@null</item> <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> <item name="android:backgroundDimEnabled">true</item> <item name="android:width">50dip</item> <item name="android:height">50dip</item> <item name="android:background">@android:color/transparent</item> </style> ``` Any help is appreciated in advance

Original source

Related problems