我正在尝试从单个选择列表视图中获取所选值,但它不会让我使用setOnItemClickListener
任何想法?
final ListView lv = (ListView) findViewById(R.id.listView1);
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_single_choice, values);
lv.setAdapter(arrayAdapter);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> myAdapter, View myView, int myItemInt, long mylng) {
String selectedFromList = (lv.getItemAtPosition(myItemInt));
}
}