Android ProgressDialog with setContentView

喜你入骨 提交于 2019-11-28 09:23:58
Mejonzhan

I made it; in fact, it's very easy; using

loadingProgressDialog.setContentView(this) 

after

loadingProgressDialog.show() 

The following lines of code are unnecessary:

loadingProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
loadingProgressDialog.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
loadingProgressDialog.getWindow().requestFeature(Window.FEATURE_PROGRESS);
loadingProgressDialog.getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

that's to say:

loadingProgressDialog.setIndeterminate(true);
loadingProgressDialog.show();
loadingProgressDialog.setContentView(this); //this is: LoaderImageView extends ImageView 

that is enough.

I hope this can help other people looking for answer about this question.

If you read the progressDialog developer doc it says "A dialog showing a progress indicator and an optional text message or view. Only a text message or a view can be used at the same time."

It looks like you are trying to do both. Possibly the cause of your issue.

Got it.

The clue was in the class names, don't use ProgressDialog ( http://developer.android.com/reference/android/app/ProgressDialog.html ) when you don't need a dialog!

I changed my implementation to use: ProgressBar ( http://developer.android.com/reference/android/widget/ProgressBar.html ) and it works great.

Cheers for the ear anyway!

This is why I was looking for it for:

http://www.anddev.org/novice-tutorials-f8/imageview-with-loading-spinner-t49439.html

Tutorial showing how you can have a Spinner whilst an image is loading. Enjoy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!