[英]Android - Action Bar doesn't show up using Theme.AppCompat
我正在嘗試使用Theme.AppCompat
,但是當我執行Action Bar時就消失了。 沒有錯誤或任何錯誤。
問題是我在另外兩個項目上使用了這個確切的設置,它們工作正常,不確定發生了什么變化。
我還嘗試更改支持庫版本,父主題,清理項目,重建和使緩存無效。 不知道是否有任何幫助,但無論如何我都做了。
我使用的是Android Studio 0.8.14
如果我錯了,請糾正我,但這就是我在舊API上使用Material Theme小部件和調色板的方式,對吧?
預習
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
AndroidManifest.xml中
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".ActivityLogin"
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>
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}
我的回答應該是評論,但這是我能回復的唯一方法。 您是否在活動中擴展了ActionBarActivity ? 你在活動中嘗試過show()方法嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.