What is orderInCategory in ActionBar menu item & why it is use for..?

android:orderInCategory is an integer attribute that dictates the order in which the menu items will appear within the menu when it is displayed.

<menu 
    xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_item_first"
        android:orderInCategory="1"
        android:showAsAction="never"
        android:title="@string/string_one"/>

    <item
        android:id="@+id/menu_item_second"
        android:orderInCategory="2"
        android:showAsAction="never"
        android:title="@string/string_two"/>

</menu>
  • Menu items in ToolBar are arranged from left to right (or
    start to end in RTL mode) in the ascending order (i.e. 1,2,3 ->
    left to right).

    horizontal menu items

  • Menu Items in Overflow menu are arranged from top to bottom in
    the ascending order (i.e. 1,2,3 -> top to bottom).

    vertical overflow menu

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)