我需要从整个应用程序中删除ActionBar
,所以我在清单中的代码中添加了Theme.NoTitleBar
。
以下是我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beleeta.bileetacrm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.beleeta.bileetacrm.Home"
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>
</manifest>
但是,这使得整个应用程序背景看起来很黑!在我进行此更改之前,应用程序是白色的,下面是代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.beleeta.bileetacrm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.beleeta.bileetacrm.Home"
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>
</manifest>
为什么会这样?我怎样才能摆脱这个?这是我第一次处理这些操作栏。
我的最小 SDK 是 11。
默认Theme
(因此,Theme.NoTitleBar
)是深色主题 - 您可以将Theme.Light.NoTitleBar
用于浅色(即背景)主题。
从清单文件中删除android:theme="@android:style/Theme.NoTitleBar"
。 并添加这个
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
在你设置内容视图之前,到每个类。