Вопрос

Problem : Menu Not displayed in the bottom (displayed in top !)

ASB Library : The last version

Device : Tablet

Android OS: 4.2

menu_bottom.xml :

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- SplitActionBar Menu-->
     <item
            android:id="@+id/aproximite"            
            android:title="A Proximite"
            android:icon="@android:drawable/ic_menu_mylocation"
            android:showAsAction="ifRoom"/>
    <item
            android:id="@+id/qrcode"                  
            android:showAsAction="ifRoom"
            android:icon="@android:drawable/ic_menu_view"
            android:title="Lecteur QR"/>

</menu>

Manifest :

        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:uiOptions="splitActionBarWhenNarrow"
            android:label="@string/app_name">                                              
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

MainActivity.java :

// Comment ...    ...               
    public class MainActivity extends SherlockFragmentActivity implements TabListener {

...

//Comment
    getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME); 
            setupTabs();

...

            // Inflate the menu; this adds items to the action bar if it is present.
  @Override
        public boolean onCreateOptionsMenu(Menu menu) {
           MenuInflater inflater = getSupportMenuInflater();
           inflater.inflate(R.menu.menu_bottom, menu);
           return super.onCreateOptionsMenu(menu);
        }
Это было полезно?

Решение

As far as I know (tested!) splitActionBar works only on phones, because the screen size is much smaller than tablets and it takes space at the bottom for extra space for your action items. On tablets, the screen size is much bigger and there is enough space for most of the action items, that's why your menu is placed on top.

Другие советы

Have you tried using

setHasOptionsMenu(true);

in your fragments?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top