public void onItemClick(AdapterView<?>parent, View view, int position, long id)
// parent是识别是哪个listview;
// view是当前listview的item的view的布局,就是可以用这个view,获取里面的控件的id后操作控件
// position是当前item在listview中适配器里的位置
// id是当前item在listview里的第几行的位置
例如:在ListView中自定义布局里有一个TextView组件,需要取出TextView中的内容可以用如下做法
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //collectionContent为自定义布局中TextView的id TextView textView= (TextView) view.findViewById(R.id.collectionContent); Toast.makeText(this, textView.getText(), Toast.LENGTH_SHORT).show(); }