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中的內容可以用如下做法
這個很簡單的只要將你寫在Adapter的 賦值的控件找到 就可以了
@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();
}