我想在 ActionBarSherlock 的 ArrayAdapter 上添加 setOnClickListner ,这样当我单击该项目时,它会更改片段,但顶部的操作栏保持显示相同的栏(就像除了操作栏之外的完整布局发生更改)
如何在此代码中添加 setOnClickListner。这是片段之一的代码:
public class DetailsFragment extends SherlockListFragment{
/** An array of items to display in ArrayList */
String details_data[] = new String[]{
"Personal Info",
"Emergency Contacts",
"Application Codes",
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
/** Creating array adapter to set data in listview */
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity().getBaseContext(), android.R.layout.simple_list_item_multiple_choice, details_data);
/** Setting the array adapter to the listview */
setListAdapter(adapter);
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onStart() {
super.onStart();
/** Setting the multiselect choice mode for the listview */
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
}