我的工作自定义进度对话框
。我给自己定了风格像这太问题Positionning在自定义进度对话框纺车的我的进度对话框是显示没有在所有的动画。当我改变了背景
到黑色
然后将其只显示一个黑盒子。我希望我的进度对话框动画。
在活动,我做这样的事情。
公共MyProgressDialog(上下文的背景下){ 超(背景下,R.style.NewDialog); }
和NewDialog是:
<样式名称=NewDialog父=@安卓风格/ Theme.Dialog> <项目名称=机器人:窗框> @空< /项目> <项目名称=机器人:windowBackground> @android:彩色/透明< /项目> <项目名称=机器人:windowIsFloating>真< /项目> <项目名称=机器人:windowContentOverlay> @空< /项目> <项目名称=机器人:windowTitleStyle> @空< /项目> <项目名称=机器人:windowAnimationStyle> @android:风格/ Animation.Dialog< /项目> <项目名称=机器人:windowSoftInputMode> stateUnspecified | adjustPan< /项目> <项目名称=机器人:backgroundDimEnabled>真< /项目> <项目名称=机器人:宽> 50dip< /项目> <项目名称=机器人:身高> 50dip< /项目> <项目名称=机器人:背景> @android:彩色/透明< /项目>< /风格>
![选择自定义动画 4.弹出自定义动画对话框 5.按图操作](https://p.xsw88.cn/allimgs/daicuo/20230906/2872.png)
任何帮助是AP $ P $提前pciated
解决方案 进口android.app.ProgressDialog;进口android.content.Context;进口android.view.animation.Animation;公共类MyProgressDialog扩展ProgressDialog { 公共MyProgressDialog(上下文的背景下){ 超(背景下,R.style.NewDialog); // TODO自动生成构造函数存根 }}
// RESOURCE样式文件水库 - >值时─> mydialog.xml
<?XML版本=1.0编码=UTF-8&GT?;<资源> <样式名称=NewDialog父=@安卓风格/ Theme.Dialog> <项目名称=机器人:窗框> @空< /项目> <项目名称=机器人:windowBackground> @android:彩色/透明< /项目> <项目名称=机器人:windowIsFloating>真< /项目> <项目名称=机器人:windowContentOverlay> @空< /项目> <项目名称=机器人:windowTitleStyle> @空< /项目> <项目名称=机器人:colorBackground>#FFFFFF< /项目> <项目名称=机器人:windowAnimationStyle> @android:风格/ Animation.Dialog< /项目> <项目名称=机器人:windowSoftInputMode> stateUnspecified | adjustPan< /项目> <项目名称=机器人:backgroundDimEnabled>真< /项目> <项目名称=机器人:宽> 600dip< /项目> <项目名称=机器人:身高> 100dip< /项目> <项目名称=机器人:文字颜色>#FF0000< /项目>< /风格>< /资源>
//并使用此code ANYWHERE在应用程序中获取自定义进度对话框
MyProgressDialog PD =新MyProgressDialog(YouActivity.this);pd.setMessage(Loading请稍候......);pd.show();
那么有没有在你的code和矿山任何区别,因为我已经运行code只是为了测试是否遇到任何问题或没有,但还是我张贴了你,让你可以追捧出的问题。
感谢:)
I am working on Custom Progress Dialog
. I've set its style like done in this SO question Positionning the spinning wheel in a custom progress dialog My progress dialog is showing no animation at all. When I changed the background
to black
then it was only showing a black box. I want my progress dialog to animate.
In activity I am doing something like this
public MyProgressDialog(Context context) {
super(context, R.style.NewDialog);
}
and the NewDialog is as:
<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:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:width">50dip</item>
<item name="android:height">50dip</item>
<item name="android:background">@android:color/transparent</item>
</style>
Any help is appreciated in advance
解决方案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);
// TODO Auto-generated constructor stub
}
}
//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 ANYWHERE IN YOUR APPLICATION TO GET CUSTOM PROGRESS DIALOG
MyProgressDialog pd = new MyProgressDialog(YouActivity.this);
pd.setMessage("Loading. Please wait...");
pd.show();
Well there isn't any difference in your code and mine as I have run your code just to test whether you are experiencing any problem or not but still I am posting for you so that you can sought out the problem.
Thanks :)
相关推荐
最新文章