我目前在操作栏中使用列表菜单,代码如下:
Context context = getSupportActionBar().getThemedContext();
ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item);
list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(list, this);
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
// When menu item is selected and is different from currently selected menu item
}
Right now the callback is only fired if the menu item selected is different from the currently selected item. 即使新选择的菜单项相同,如何使其触发?