I do not understand ifRoom functionality on Android


I am creating a ToolBar with 6 icons if in your xml I put app:showAsAction="ifRoom" minus two, the others are grouped in a dropmenu.

I understand that it is grouped the items if there is no space for them, but I see that there is a lot of space left, can fit 2 or 3 more.

If the device is broken, only two are shown and all of them could be displayed.

My question what guidelines are established with the ifRoom?

asked by Webserveis 18.06.2016 в 20:44

1 answer


app:showAsAction="ifRoom" as you comment, it indicates that if there is space it shows the icons if you do not add them in the menu that you mention "dropmenu". It's something I've noticed in some devices that sometimes does not seem to group them but that's decided by the operating system.

They can fit 2 or 3 more but for guidelines in the middle should have some space to show for example a title related to the activity / fragment. If you try a tablet surely if you show them by the space that is greater.


app: showAsAction="ifRoom" Indicates that you add the icon to the bar if there is space for it. If there is no space for all the elements   marked "ifRoom", the elements with the lowest values   orderInCategory are displayed as the actions and elements   remaining are shown in the overflow menu.

answered by 18.06.2016 / 21:14