如何在列表视图中的项目Click listener上访问列表视图的控件?因为我为单个列表视图项设置了自定义布局。
答案 0 :(得分:1)
在创建列表视图的活动中尝试类似于这些
的活动private void setupListView() {
//find by view id
customListView = ((ListView) findViewById(R.id.lv_listview);
//set custom adapter
customListView.setAdapter(
new CustomListAdapter(this, R.id.lv_listview, variableList));
//attach listener
customListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
/* whatever happens when you click the list item goes here */
}
});
}