More MenuItems shown than needed after rotation in Android -


I have an app (for 4.0 and above) in which MenuItem s Actionbar (with one more 'always' and 'ifRoom' or 'never' property).

So the problem happens ... If I launch the app in landscape, actionbars resembles the following:  launches in landscape mode

When I rotate the landscape from the picture, the actionbar looks like this: Img src = "https://i.stack.imgur.com/cBn19.png" alt = "Pictures from Landscape">

As you can see, they show more icons than they look like Give, i.e. title bar and tab menu (nav Has not left any space for Geshn menu). Actually, 4 items are shown in portrait mode (this is a separate actionbase) and it seems Android does not know that there is no split actionbare now.

Please suggest that what can I do to fix this? :)


Edit

My menu.xml:

  Menu xmlns: android = "http://schemas.android. Com / apk / res / android "& gt; & Lt; item android: id = "@ + id / action_share" Android: icon = "@drawable / ic_menu_share" android: showAsaction = "always" Android: title = "@ string / share" /> Android: Android: showAsAction = "ifroom" Android: title = "@ string / switch_view" /> & lt; Item android: id = "@ + id / action_upload" Android: icon = "@drawable / ic_manu_upload" Android: showAsAction = "ifRoom" Android: title = "@ string / upload" /> & Lt; Item android: id = "@ + id / action_new" folder: Android: icon = "@ drawable / ic_manu_n_folder" android: showAsAction = "ifRoom" Android: title = "@ string / create_folder" /> & Lt; Item android: id = "@ + id / action_multiselect" Android: icon = "@drawable / ic_manu_septicle" Android: showAsAction = "ifRoom" Android: title = "@ string / selection_mode" /> & Lt; Item android: id = "@ + id / action_refresh" Android: icon = "@drawable / ic_menu_reference" Android: showAsAction = "ifRoom" Android: title = "@ string / refresh" /> & Lt; item android: id = "@ + id / action_settings" Android: icon = "@drawable / ic_menu_settings" android: showAsAction = "never" android: title = "@ string / action_settings" /> & Lt; / Menu & gt;    

An important feature for menu items is XML, Android: showAsAction, which defines The visibility of the action object is clear from your code that if there is room in the action bar then it will be displayed. So if you do not want to specify this Android: showAsAction value never be that whatever the orientation is, it will only appear in the overflow menu.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -