`

关于消除标题栏的问题研究 (ActionBarActivity)

 
阅读更多

Android开发去除标题栏title其实非常简单,有两种方法,一种是在代码中添加,另一种是在AndroidManifest.xml中添加:
1、在代码中实现:
在此方法setContentView(R.layout.main)之前加入:
requestWindowFeature(Window.FEATURE_NO_TITLE);标题栏就没有了。
2、在AndroidManifest.xml中实现:
注册Activity时加上如下的一句配置就可以实现。

<activity  android:name=".Activity"
android:theme="@android:style/Theme.NoTitleBar">
</activity>


但是这是需要继承旧的Activity的,当使用新的ActionBarActivity会失效

The general rule is that if you want your activity to have an action bar it should have the AppCompat theme and the java code should extend ActionBarActivity. If you have an activity that doesn't need an action bar (like a dialog themed activity) you can apply any theme to it but the java code must extend plain old activity.

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics