0

I'm trying to add AcionBar to my application.
I created a BaseActivity where all other activities extend it:

BaseActivity.java

public class BaseActivity extends ActionBarActivity{
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // TODO Auto-generated method stub
        return super.onCreateOptionsMenu(menu);
    }
}

MainActivity.java

public class Main extends BaseActivity {
// other code..
}

AndroidManifest.xml:

<application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/BaseTheme" >



        <activity
            android:name="omar.asd.Main"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


themes.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="BaseTheme" parent="@style/Theme.AppCompat.Light">

        <!-- hide the Window Title -->
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>

        <!-- You could change the scrollbar, checkbox style, anything! -->
    </style>

</resources>

As you can see, I created a custom theme, BaseTheme, to apply "Theme.AppCompat.Light" to all the application..
The problem is that the ActionBar doesnt appear in any activity..

Why is this?

Omar
  • 7,835
  • 14
  • 62
  • 108
  • it may be same however i am not sure http://stackoverflow.com/questions/20713806/android-support-action-bar-not-showing-overflow-menu – Jitesh Upadhyay Feb 24 '14 at 07:07

2 Answers2

1
<!-- hide the Window Title -->
<item name="android:windowNoTitle">true</item>

Your App theme is no titile,so ActionBar impossible appear in any activity

laomo
  • 436
  • 4
  • 12
0

Add a style for your ActionBar in the styles.xml

<style name="CustomWindowTitleBackground"> <item name="android:background">#1998ca</item> <item name="android:paddingLeft">15dip</item> <item name="android:textColor">@android:color/white</item> </style>

and then add these two items in your BaseTheme

<item name="android:windowTitleSize">40dip</item> <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>

and remove this item from your BaseTheme <item name="android:windowNoTitle">true</item>

Madhav
  • 1