I tried to implement an action bar in my application.
menu.xml
An application with a Manifest like this
Menu.xml like this
And Activity like this
package com.example.Actionbartest;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
}
Looks like this.
Are you sure your phone or emulator is running Android 3.0 or above? If not, you will end up with your screenshot.
To enable The Actionbar on older devices, you should use the AppCompat/support library (https://developer.android.com/tools/support-library/features.html)