当我单击项目时,我的 onListItemClick 永远不会被调用,该类是扩展片段而不是 listfragment,因为我在这个片段中有其他视图项目不是列表,那么如何在类扩展片段中实现 onlistitemclick?
班级
public class MainFiles extends Fragment
{
ArrayList<String> items;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.files, container, false);
Button button_up = (Button) view.findViewById(R.id.button_up);
items = new ArrayList<String>();
MyAdapter adapter = new MyAdapter(getActivity(), R.layout.row, items);
ListView myList = (ListView) view.findViewById(R.id.list);
myList.setAdapter(adapter);
return view;
}
public void onListItemClick(ListView l, View v, int position, long id)
{
}
}