2012-03-28 115 views

回答

2

您可以使用assync任务为目的...制作图像的图形并应用旋转动画..在此mAnimation中是要旋转的imageview ...将此imageview放置在屏幕上,并在后execute..in后看不见的执行清晰动画和做其他的东西

private class LoadAssync extends AsyncTask<String, Void, Void> { 

    protected void onPreExecute() { 
     mAnimation.startAnimation(anim); 
    } 

    protected Void doInBackground(final String... args) { 
     //do the task here 

    } 

    protected void onPostExecute(final Void unused) { 
     mAnimation.clearAnimation(); 
        mAnimation.setVisibility(View.GONE); 

    } 


} 

在rotation.xml

<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
android:duration="1200" 
android:fromDegrees="0" 
android:pivotX="50%" 
android:pivotY="50%" 
android:repeatCount="infinite" 
android:toDegrees="360" 
android:interpolator="@android:anim/linear_interpolator" > 

</rotate> 

希望这有助于

+0

进展图片被替换,但我得到了进度对话框的背景窗口。我不想那样。我也想删除它。 – VaaS 2012-03-28 04:03:32

+0

我编辑了我的答案... – 2012-03-28 05:40:15

0

所有你需要做的是建立与宽度的自定义样式设置为wrap_content

<style name="DialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> 
    <!--Other custom stuff if needed--> 
    <item name="android:layout_width">wrap_content</item> 
</style> 

然后将此样式添加到ProgressDialog

final ProgressDialog mDialog = new ProgressDialog(getActivity(), R.style.DialogStyle); 
mDialog.setMessage("Loading... Please wait..."); 
mDialog.setCancelable(false); 
mDialog.show(); 
mDialog.setContentView(avLoadingIndicatorView); 

演示

enter image description here

相关问题