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);
// 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 AT ANY TIME IN YOUR APPLICATION TO GET THE CUSTOM PROGRESS DIALOG
MyProgressDialog pd = new MyProgressDialog(YouActivity.this); pd.setMessage("Loading. Please wait..."); pd.show();
Well, there is no difference in your code and mine, since I ran your code to check if you have any problems or not, but still I am sending you messages so that you can find the problem.
Thanks:)
source share