ControlAltDelete
ControlAltDelete

Reputation: 3724

Android Menu Group Checkable

I currently am programming for API 10 and above. I created a menu and was looking to implement the method Menu.setGroupCheckable(id, checkable, exclusive). Below is my code. From the documentation I was expecting a check mark over the selected item out of the group and the other ones to be disabled. However, this is not the case.

 @Override
public boolean onCreateOptionsMenu(Menu menu) {
     super.onCreateOptionsMenu(menu);
     menu.add(0, 1, 0, "I1").setIcon(R.drawable.ic_launcher);
     menu.add(0, 2, 1, "I2");
     menu.add(0,3,2,"I3");

     menu.add(1, 4, 3, "I4");
     menu.add(1, 5, 4, "I5");
     menu.add(1,6,5,"I6");

    menu.setGroupCheckable(1, true, true);

     return true;
}

Android documentation link: http://developer.android.com/reference/android/view/Menu.html

Upvotes: 0

Views: 4768

Answers (2)

Akash Jagtap
Akash Jagtap

Reputation: 404

use Updated lib

compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0'

Upvotes: 0

Related Questions