如何在android中执行doInBackground()时显示动画(如应用程序的徽标)

如何在android中执行doInBackground()时显示动画(如应用程序的徽标),android,android-asynctask,jquery-animate,Android,Android Asynctask,Jquery Animate,我想在执行异步任务的ever doInBackground()方法时显示动画应用程序徽标,而不是进度对话框或进度条 请参阅Expedia Android应用程序的参考资料 请帮帮我。提前感谢…正如Rank指出的那样 @Override protected void onPreExecute() { //do animation stuff here super.onPreExecute(); } 然

我想在执行异步任务的ever doInBackground()方法时显示动画应用程序徽标,而不是进度对话框或进度条

请参阅Expedia Android应用程序的参考资料

请帮帮我。提前感谢…

正如Rank指出的那样

        @Override
        protected void onPreExecute() {
            //do animation stuff here
            super.onPreExecute();
        }
然后

protected void onPostExecute(Object result) {
        //end animation here
        super.onPostExecute();  
        }
您应该在onPreExecute()中使用自定义对话框
Dialog mDialog=新建对话框(mContext,
android.R.style.Theme(半透明的NoTitleBar);
mDialog.setContentView(R.layout.progressbar);
mDialog.setCancelable(假);
mDialog.show()`在这里输入代码`

>>…这是您自定义对话框栏的布局…。您有用于动画的
.gif
吗?我不知道请给我建议步骤。Hi@sambal在onPreExecute()方法中我们可以调用自定义对话框进度栏,正如您看到我的帖子一样
You should use custom dialog in  onPreExecute()



Dialog mDialog = new Dialog(mContext,
                android.R.style.Theme_Translucent_NoTitleBar);
        mDialog.setContentView(R.layout.progressbar);
        mDialog.setCancelable(false);
        mDialog.show();`enter code here`


<>>>....This is layout of you custom dialogbar........<<<<<<<<<<<

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="150dip"
    android:layout_height="150dip"
    android:layout_gravity="center"
    android:background="@drawable/progressbar_shap"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="Please Wait..."
         android:layout_centerInParent="true"
        android:textStyle="bold" />

    <ProgressBar
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_centerInParent="true"
        android:indeterminateDrawable="@drawable/my_progress_indetermine" >
    </ProgressBar>

</RelativeLayout>


<...................Giving shape to dialog  progressbar_shap................>

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/shape_my" >

    <stroke
        android:width="2dp"
        android:color="#636161" />

    <padding
        android:bottom="20dp"
        android:left="20dp"
        android:right="20dp"
        android:top="20dp" />

    <corners android:radius="24dp" />

    <solid android:color="#88000000" />

</shape>

<.................. my_progress_indetermine .................>

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
        android:drawable="@drawable/please_wait"
        android:pivotX="50%"
        android:pivotY="50%" />