下面是正确的代码,用于隐藏标题的。
super.onCreate(savedInstanceState); //取消标题 requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main);
然而有时候我们是没有注意到,写成下面那样。
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
//取消标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
</pre><pre name="code" class="java" style="color: rgb(102, 102, 102);"><span style="font-size:14px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">这样就会出现java.lang.RuntimeException:Unable to start activity ComponentInfo</span>