我有两个分辨率为800x600 original的帧动画,但我接受了result2。我的问题是如何改变尺寸可绘制或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>
活性
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();
答案 0 :(得分:0)
我修复了它,在上面看到的Dialog和styles.xml上更改ProgressDialog,删除它。我的gif结果: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();