android - Handling menu in dual pane fragments -


i have fragment layout below.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"  android:baselinealigned="false">  <fragment     android:id="@+id/callslistfragment"     android:layout_width="0dp"     android:layout_weight="1.5"     android:layout_height="match_parent"     class="com.example.mycallslistfragment" />  <fragment     android:id="@+id/calldetailfragment"     android:layout_width="0dp"     android:layout_weight="2"     android:layout_height="match_parent"     class="com.example.mycallsdetailsfragment" />  </linearlayout>  

the first fragment shows list of calls made , second 1 details. each of them has separate menu option.

say callslistfragment has 2 menu items such

view outstanding calls calls today 

calldetailfragment has 3 menu items such as

edit call add new call archive call 

i inflate menus respective fragments.

@override public void oncreateoptionsmenu(menu menu, menuinflater inflater) {    inflater.inflate(r.menu.menu_mycalls, menu); } 

however, in dual pane, see 5 menu items rather conflicting hard find 1 which.

is approach show menu items? guide me through correct way of doing it?

the app support both tablets , handsets.

check 2 pane mode when create option menu.

boolean mtwopane = // istwopane ?  @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) {    if (mtwopane) return; // if (!mtwopane) return;    inflater.inflate(r.menu.menu_mycalls, menu); } 

or, make new menu 2 pane mode. (make resource folder "menu-land")


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -