Android:在选择相同列表项时激活列表导航回调

时间:2013-05-06 06:19:07

标签: java android

我目前在操作栏中使用列表菜单,代码如下:

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
}

现在只有在所选菜单项与当前所选项不同时才会触发回调。即使新选择的菜单项是相同的,我怎样才能使它生效?

0 个答案:

没有答案