Last active
August 29, 2015 14:04
-
-
Save jaydeep-utl/8fbd4614fb534764940a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========= | |
styles.xml | |
========= | |
<style name="TransparentProgressDialog" parent="@android:Theme.Holo.Light.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:background">@android:color/transparent</item> | |
</style> | |
========================== | |
custom_progress_layout.xml | |
========================== | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:alpha="0.5" | |
android:gravity="center" | |
android:orientation="vertical" > | |
<ProgressBar | |
android:id="@+id/progressBar1" | |
style="?android:attr/progressBarStyleLarge" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:indeterminateDrawable="@drawable/custom_progress_drawable" /> | |
</LinearLayout> | |
============================ | |
custom_progress_drawable.xml | |
============================ | |
<?xml version="1.0" encoding="utf-8"?> | |
<rotate xmlns:android="http://schemas.android.com/apk/res/android" | |
android:fromDegrees="0" | |
android:pivotX="50%" | |
android:pivotY="50%" | |
android:toDegrees="360" > | |
<shape | |
android:innerRadiusRatio="3" | |
android:shape="ring" | |
android:thicknessRatio="8" | |
android:useLevel="false" > | |
<size | |
android:height="10dip" | |
android:width="10dip" /> | |
<gradient | |
android:centerColor="#4c737373" | |
android:centerY="0.50" | |
android:endColor="#ffffd300" | |
android:startColor="#4c737373" | |
android:type="sweep" | |
android:useLevel="false" /> | |
</shape> | |
</rotate> | |
================= | |
TestActivity.java | |
================= | |
Dialog dialog = new Dialog(context, R.style.TransparentProgressDialog); | |
dialog.setCancelable(false); | |
dialog.setCanceledOnTouchOutside(false); | |
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); | |
dialog.setContentView(R.layout.custom_progress_layout); | |
dialog.show(); | |
/* | |
... | |
... | |
*/ | |
dialog.dismiss(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment