Action bar does not show options menu in jelly bean,while it is shown in lollipop. here is my styles.xml`
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#00796B</item>
<item name="colorPrimaryDark">#004D40</item>
<item name="colorAccent">#c51162</item>
<item name="android:textColorPrimary">@color/abc_primary_text_disable_only_material_dark</item>
</style>
</resources>`
here is my app gradle
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.dell.syncytium"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
My MainActivity extends AppCompatActivity. please help me.thanks in advance
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean result = super.onCreateOptionsMenu(menu);
menu.add(0, logoutMenu, 0, "Logout");
menu.add(0,Play,1,"Play Music");
menu.add(0,Stop,2,"Stop Music");
return result;
}
menu.xml
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/connect_scan"
android:icon="@drawable/menu"
android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/discoverable"
android:icon="@android:drawable/ic_menu_mylocation"
android:showAsAction="ifRoom|withText"/>
</menu>
MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.option_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu:
break;
case R.id.discoverable:
break;
}
return false;
}
}