×

Welcome to TagMyCode

Please login or create account to add a snippet.
1
0
 
0
Language: Java
Posted by: Hafiz Waleed Hussain
Added: Jul 26, 2013 10:58 AM
Views: 1851
  1.  
  2. public static Dialog createDialog(Context context) {
  3.                 Dialog dialog = new Dialog(context);
  4.                
  5.    // Remove title from dialog
  6.                 dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  7.                
  8.   // Remove dialog background to transperant
  9.                 dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  10.                
  11.   // The custom layout
  12.                 dialog.setContentView(R.layout.progress_layout);
  13.                 dialog.setCancelable(false);
  14.                 return dialog;
  15.         }
  16.  
  17. // Android custom layout code
  18. <?xml version="1.0" encoding="utf-8"?>
  19. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  20.     android:layout_width="match_parent"
  21.     android:layout_height="match_parent"
  22.     android:gravity="center"
  23.     android:orientation="vertical" >
  24.  
  25.     <ProgressBar
  26.         android:layout_width="wrap_content"
  27.         android:layout_height="wrap_content"
  28.         android:indeterminateDrawable="@drawable/progress_drawable" />
  29.  
  30. </LinearLayout>
  31. //-------------------------------------------------------------------------------------------------------------------
  32.  
  33. // Custom Drawable progress_drawable"
  34. <?xml version="1.0" encoding="utf-8"?>
  35. <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
  36.     android:drawable="@drawable/my_spinner"
  37.     android:pivotX="50%"
  38.     android:pivotY="50%" />
  39.  
  40.  
  41.  
  42.