Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make Menu Groups in android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 576
    Comment on it

    In the below code I have created Menu Groups. Simply I have added menu items in menu folder, all menu item are added in group. See the below code it will clearly described how to make Menu Groups .

    Step(1)-MainActivity-

    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
    }
    

    Step(2)-Added menu items in Menu folder-

    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item
            android:id="@+id/menu_bookmark"
            android:icon="@drawable/icon_bookmark"
            android:title="Read"/>
        <!-- menu group -->
        <group android:id="@+id/group_delete" >
            <item
                android:id="@+id/menu_more"
                android:title="write"/>
    
             <item
                android:id="@+id/menu_delete"
                android:title="Save"/>
            <item
                android:id="@+id/menu_delete"
                android:title="Delete"/>
        </group>
    
    </menu>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: