有两种简单的方法可以在非全屏模式下去掉Android程序的标题栏
第一中方法:
在Activity的onCreate过程中加入
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
此句应放在super.onCreate之后,setContentView之前。
第二中方法:
设置主题。例如定义如下主题:
<style name="windowStyle">
<item name="android:windowNoTitle">true</item>
</style>
然后在AndroidManifest.xml中 application 段设置主题如下:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/windowStyle">
<activity android:name=".Contributor"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
或者在代码中设置输入:
setTheme(R.style.microchenTheme);