2010-04-03 101 views
3

我按照文档中的customdialog example中的步骤操作,但出现此异常。有任何想法吗?在android中定制进度对话框?

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 

回答

10

最有可能的,你在呼唤setContentView()后调用requestWindowFeature()。你可能并不是直接这样做,而是你继承的那些课程,因为你正在做一些其他的事情,这些事情有点不合时宜。

因此,找出你在做什么,并改变顺序,你可以先致电requestWindowFeature()

例如,here is a sample project来自我的一本使用进度指示器标题栏技巧的书,因此需要拨打requestWindowFeature()。在拨打setContentView()之前,我必须在onCreate()之前完成此操作。

+0

我们如何定制具有自定义背景和自定义按钮(正面和取消)的ProgressDialog框?请转到我需要的代码示例。 – Sam 2014-02-26 11:51:16