且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

定制进度对话框中的android?

更新时间:2023-01-24 13:20:07

最有可能的,你是叫 requestWindowFeature()呼叫后的setContentView() 。这可能是你没有做直接,而是从继承的类,因为你正在做一些其他的事情稍微超出序列。

所以,找出你正在做的和改变,这样你拨打订购 requestWindowFeature()第一。

例如,这里是从一个示例项目我使用进度指示器 - 在最标题栏的技巧,因此书籍需要调用 requestWindowFeature()。我不得不这样做,在的onCreate()调用的setContentView()的活动之前。

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

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.

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 in onCreate() before calling setContentView() on the activity.