Issue
I have two frame animation of their resolution 800x600 original, but i take this result2. My question how change size drawable or problem with ProgressDialog?
bulb_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/bulb1"
android:duration="350"/>
<item android:drawable="@drawable/bulb2"
android:duration="350"/>
</animation-list>
styles.xml
<style name="MyThemeProgress" parent="ThemeOverlay.AppCompat.Dialog">
<item name="android:alertDialogStyle">@style/CustomAlertDialogStyle</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:title">false</item>>
<item name="android:textColorPrimary">#FFFFFF</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:textStyle">normal</item>
<item name="android:textSize">12sp</item>
</style>
<style name="CustomAlertDialogStyle">
<item name="android:bottomBright">@android:color/transparent</item>
<item name="android:bottomDark">@android:color/transparent</item>
<item name="android:bottomMedium">@android:color/transparent</item>
<item name="android:centerBright">@android:color/transparent</item>
<item name="android:centerDark">@android:color/transparent</item>
<item name="android:centerMedium">@android:color/transparent</item>
<item name="android:fullBright">@android:color/transparent</item>
<item name="android:fullDark">@android:color/transparent</item>
<item name="android:topBright">@android:color/transparent</item>
<item name="android:topDark">@android:color/transparent</item>
</style><br><br>
activity
dialog = new ProgressDialog(this,R.style.MyThemeProgress);
dialog.setCancelable(false);
dialog.setProgressStyle(android.R.style.Animation_Activity);
dialog.setIndeterminate(true);
dialog.setIndeterminateDrawable(this.getResources().getDrawable(R.drawable.bulb_anim));
dialog.show();
Solution
i fixed it, change ProgressDialog on Dialog and styles.xml which you see above, delete it. my gif result:bulb_anim
transparant_color.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@color/transparent"></item>
</selector>
my_activity.java
dialog = new Dialog(this, android.R.style.Theme_Dialog);
dialog.setCancelable(false);
ImageView imageView = new ImageView(this);
imageView.setBackgroundResource(R.drawable.bulb_anim);
int width = WRAP_CONTENT;
int height = WRAP_CONTENT;
LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(width,height);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(imageView);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.transparent_color));
dialog.show();
animationDrawable = (AnimationDrawable) imageView.getBackground();
animationDrawable.start();
Answered By - mario
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.