我在androidmanifest.xml里面的application标签配置theme为notitlebar,但是现在应用的某些标签需要显示标题栏,然后我在activity里面的oncreate方法加入requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);  
setContentView(R.layout.thread);
this.getWindow().setTitle("hello");
上面语句后程序报错:android.util.AndroidRuntimeException: requestFeature() must be called before adding content
求助一下

解决方案 »

  1.   

    util.AndroidRuntimeException: requestFeature() must be called before adding content将requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);  方法  放在setContentView(R.layout.thread)之前执行就OK了
      

  2.   

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
    this.getWindow().setTitle("hello"); 
    setContentView(R.layout.thread);
     
      

  3.   

    setTitle应该放最下面把,还有直接this.setTitle就行了,为什么要getWindow呢
      

  4.   

    可以在androidmanifest.xml中activity标签中添加标题