Android的ProgressDialog用的setContentViewAndroid、ProgressDialog、setContentView

2023-09-05 11:15:58 作者:细腰丰臀摇摆我的欲望ゐ

我读过很多关于这个的地狱,并不能看到任何人谁的完成或之前尝试过。

I've read a hell of a lot about this, and can't see anyone who's done or tried it before.

所以,我有一个对象,它扩展了ImageView的,那么在此我呼吁进度对话框,并设置进度对话框的内容ImageView的(即试图绘制进度对话框中的imageview..view。)

So I've got an object that extends ImageView, then within this I call a progress dialog and set the progress dialogs's content to the imageview (i.e. attempting to draw the progress dialog in the imageview..view.)

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

和我得到的错误:requestFeature()添加内容之前,必须名为

And I get the error: requestFeature() must be called before adding content

现在我已经在帖子加载之前见过这种错误,是的,答案似乎是显而易见的。我试图将所有的功能:

Now I've seen this error before on loads of posts and yes the answer seems obvious. I've tried to set all the features:

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);

但首先,我不明白为什么我需要这个?其次他们没有反正工作!

But first I don't understand why I need this? And second none of them work anyway!

所以,问题是,我可以设置ProgressDialog内容查看到ImageView的?如果是的话你有什么我得到错误的?

So the question is can I set the ProgressDialog contentView to an ImageView? If so what have I gotten wrong?

推荐答案

明白了。

线索是在类名,不要使用ProgressDialog( HTTP: //developer.android.com/reference/android/app/ProgressDialog.html ),当你不需要一个对话框!

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!

我改变了我的实现使用:进度条( http://developer.android .COM /参考/安卓/空间/ ProgressBar.html ),它的伟大工程。

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

干杯的耳朵呢!

这就是为什么我一直在寻找它:

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

 
精彩推荐
图片推荐