I was just wondering if it were at all possible for an Action Bar icon to only be shown when the device is in landscape mode? In portrait I have an onscreen button for a certain task, but in order to take advantage of all of the screen-space in landscape, that button won't fit. So I was wondering if I could put it in the Action Bar, but it would only be necessary when the device is in landscape.
Thanks!
You can define a specific menu XML for when the activity is in landscape orientation by putting it inside the /res/menu-land
folder.
res/menu
, and the app works fine in both screen mode. Do you have a link to Android documentation - NoName 2012-05-27 19:38
res/menu
) it will use that in all screen/orientation combinations - dmon 2012-06-05 03:44
/res/menu-land
, but not in /res/menu
, you can check in onCreateOptionsMenu()
and just don't load it. Anyway, now I got him, with an empty menu, you don't need to check screen orientation. There are many ways for a target :- - NoName 2012-06-05 04:32
menu/
or you'll get an exception in portrait - Jake Wharton 2012-04-03 23:46