android 中的自定义进度对话框?
我按照 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
I follow the steps in the customdialog example in the documentation, but I get this exception. Any ideas?
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是,您在调用
setContentView()
之后调用requestWindowFeature()
。可能您没有直接这样做,但是您继承的类是这样做的,因为您正在做一些稍微不按顺序的其他事情。因此,找出您在哪里执行此操作并更改顺序,以便首先调用
requestWindowFeature()
。例如,这是一个示例项目我的书使用标题栏中的进度指示器技巧,因此需要调用
requestWindowFeature()
。在对 Activity 调用setContentView()
之前,我必须在onCreate()
中执行此操作。Most likely, you are calling
requestWindowFeature()
after callingsetContentView()
. 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.So, find out where you are doing that and change the order such that you call
requestWindowFeature()
first.For example, here is a sample project from 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 inonCreate()
before callingsetContentView()
on the activity.