android中的自定义进度对话框?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2571361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:22:13  来源:igfitidea点击:

custom Progress Dialog in android?

androidprogressdialog

提问by Praveen

I follow the steps in the customdialog examplein the documentation, but I get this exception. Any ideas?

我按照文档中customdialog 示例中的步骤进行操作,但出现此异常。有任何想法吗?

04-03 18:50:28.787: VERBOSE/Bru_Press_Tab(750): Exception in Tabsjava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.brown/com.example.brown.Bru_Press_MostRecent}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

回答by CommonsWare

Most likely, you are calling requestWindowFeature()after calling setContentView(). It may be you are not doing that directly, but that classes you inherit from are, because you are doing some other things slightly out of sequence.

最有可能的是,您requestWindowFeature()在调用setContentView(). 可能你不是直接这样做,而是你继承的类是,因为你正在做一些稍微不按顺序的其他事情。

So, find out where you are doing that and change the order such that you call requestWindowFeature()first.

所以,找出你在做什么,然后改变顺序,让你requestWindowFeature()先打电话。

For example, here is a sample projectfrom one of my books that uses the progress-indicator-in-the-title-bar trick and therefore needs to call requestWindowFeature(). I had to do that in onCreate()before calling setContentView()on the activity.

例如,这是我的一本书中的一个示例项目,它使用了标题栏中的进度指示器技巧,因此需要调用requestWindowFeature(). onCreate()在调用setContentView()该活动之前,我必须这样做。