Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Action Bar doesn't show up using Theme.AppCompat

I am trying to use Theme.AppCompat, but when I do the Action Bar simply disappear. There is no errors or whatsoever.

The thing is I'm using this exact setting on two more projects and they work just fine, not sure what changed.

I also tried changing support library version, parent theme, cleaning the project, rebuilding and invalidating cache. Wasn't sure if any of that would help but I did anyway.

I am using Android Studio 0.8.14

Correct me if I'm wrong but that's how I use Material Theme widgets and color palette on older API's, right?

Preview

enter image description here


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'
}

like image 274
Mody Avatar asked Dec 05 '14 15:12

Mody


1 Answers

My answer should be as a comment but this is the only way I can reply. Are you extending ActionBarActivity in your activity? Have you tried the show() method in your activity?

like image 139
Azae B. Garcia Avatar answered Nov 08 '22 10:11

Azae B. Garcia