它应该有替代品吗? 谢谢你的阅读。
答案 0 :(得分:2)
试试这个:
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch(position)
case 0:
Intent myIntent = new Intent(getActivity(), OneActivity.class);
getActivity().startActivity(myIntent);
break;
case 1:
Intent myIntent = new Intent(getActivity(), OtherActivity.class);
getActivity().startActivity(myIntent);
break;
}
});