0

I just migrate to native actionBar, before, with ABS it was working great. Now, I don't need anymore compatibility as I develop for API 16+

I changed all references, and now, my menu only shows in text, with physic button, it doesn't show up in action bar...

I don't know what am I missing...

Here is my code :

main.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" >

<item
    android:id="@+id/menu_sync"
    android:icon="@drawable/ic_action_update"
    android:orderInCategory="80"
    android:showAsAction="ifRoom"
    android:title="Sync"/>
<item
    android:id="@+id/more"
    android:icon="@drawable/ic_action_core_overflow"
    android:orderInCategory="90"
    android:showAsAction="always"
    android:title="See more options">
    <menu>
        <item
            android:id="@+id/menu_send_coords"
            android:icon="@drawable/ic_action_send_coords"
            android:orderInCategory="80"
            android:showAsAction="ifRoom"
            android:title="Send Coords"
            android:visible="true"/>
        <item
            android:id="@+id/menu_foto"
            android:icon="@drawable/ic_action_device_access_camera"
            android:orderInCategory="100"
            android:showAsAction="ifRoom"
            android:title="Foto"
            android:visible="true"/>
    </menu>
</item>

In my Activity :

public class DashBoard extends BaseActivity { //BaseActivity extends ActionBarActivity
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    return super.onCreateOptionsMenu(menu);
}

I tried to change the menu xml to another one ( google example), but it did not work.

I made a search fro any reference to Sherlock* and replace all of them

In my manifest I have :

  <application
    ...
    android:theme="@style/Theme.AppCompat" >

In my style.xml I have :

     <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <!-- nothing API level dependent yet -->
</style>

    <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

I've followed each step of : http://www.grokkingandroid.com/migrating-actionbarsherlock-actionbarcompat/

What are the common issues when migrating from ActionBarSherlock to ActionBarCompat?

ActionBarCompat menu item is not showing

I don't know what more can I do??? Any help would be appreciated !

Community
  • 1
  • 1
  • So you read the [ActionBarCompat menu item is not showing](http://stackoverflow.com/questions/18770612/actionbarcompat-menu-item-is-not-showing) question, but didn't follow what it said? – ianhanniballake Jun 21 '14 at 01:44
  • You are right ! it is working now. I thought it was needed only for compatibility... Read too fast ! Tx !!! –  Jun 21 '14 at 01:48

1 Answers1

1

I think you should change your style.xml and your Android Theme since you don't ne the Android appcompat libarary anymore.

styles.xml:

<style name="AppBaseTheme" parent="@style/Theme.Holo.Light.DarkActionBar">
<!-- nothing API level dependent yet -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

AndroidManifest.xml:

    <application
        android:theme="@style/AppTheme"
    ...
Robin
  • 709
  • 2
  • 8
  • 20