amp
amp

Reputation: 12352

Adding Action Bar

I'm trying to add the Action Bar of on but it isn't shown...

I'm following this document and as I can see, the action bar should be included within the activities of the app (if it's running on Android 3.0 AVD, which is my case).

Here are some parts of my code:

AndroidManifest.xml

//...
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo"  >
//...

MenuActivity.java

public class MenuActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_menu);

    //...
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_menu, menu);
    return true;
}
}

/res/menu/activity_menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/menu_settings"
        android:title="@string/menu_settings"
        android:orderInCategory="100"
        android:showAsAction="ifRoom" />
</menu>

What am I missing here?

Upvotes: 0

Views: 3109

Answers (2)

Deepak Ranga
Deepak Ranga

Reputation: 123

in place of android:theme="@android:style/Theme.Holo" try android:theme="@style/AppTheme" in AndroidManifest.xml file

Upvotes: 0

S&#248;ren Lorentzen
S&#248;ren Lorentzen

Reputation: 866

ActionBars require Android API level 11 or greater (Android 3.0.0 or greater).

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />

Alternatively, install and use the Android Support Library.

Upvotes: 2

Related Questions