如何从ListView
即点击列表项时,它会从ListView
发送数据,并在ListView
中设置EditText
的值。
答案 0 :(得分:1)
试试这个:
listview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(<Your Class Name>.this,
"posisiton: "+position+" "+"Id: "+id, Toast.LENGTH_SHORT).show();
}
});
答案 1 :(得分:0)
这样的事情:
list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView parentView, View childView, int position, long id) {
String str = ((TextView)childView).getText().toString();
(EditText)findViewById(R.id.EditText01).setText(str);
}
});
答案 2 :(得分:0)
View curr = adapter.getView(getSelectedItemPosition(),null,null);
TextView c = (TextView)curr.findViewById(R.id.detail);