在我的应用程序中,我根据用户选择的类别向用户显示一些数据。为此,我正在使用ActionBarSherlock来显示他可以选择的类别菜单。单击一个类别时,将加载此内容。我现在想要做的是启用多选选项,带复选框和OK按钮来触发内容加载。我一直在寻找一些时间,无法弄清楚如何启用这个多选菜单。以下是我当前代码的一部分
public class CategoriesActivity extends SherlockActivity implements
ActionBar.OnNavigationListener {
private ArrayList<Category> categoryList;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(Application.THEME);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_ringtones);
Context context = getSupportActionBar().getThemedContext();
categoryList = new ArrayList<Category>();
ArrayAdapter<Category> adapter = new ArrayAdapter<Category>(context,
R.layout.sherlock_spinner_item, categoryList);
adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(adapter, this);
getSupportActionBar().setIcon(R.drawable.abs__ic_search);
// By default, load data for the first category
loadCategoryData(categoryList.get(0).getId());
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
loadCategoryData(categoryList.get(itemPosition).getId());
return false;
}