原文请点击这里
第一种,在调用setContentView()之前插入代码:
requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏 setContentView(R.layout.activity_main);
第二种,在AndroidManifest.xml文件中配置Activity:
<activity android:name="com.example.MainActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
<!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <item name="android:windowNoTitle">true</item> </style>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">