我有下面的代码,但是 onItemClickListener 不起作用,谁能帮我解决问题?我还添加了 Override 和 setClickable,但问题仍然存在。
public class Show extends Activity implements AdapterView.OnItemClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.show);
...//Some codes in here
adapter = new MyAdapter(this, hadithList);
list = (ListView) findViewById(R.id.list);
list.setAdapter(adapter);
list.setClickable(true);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(), "clickedItemString", Toast.LENGTH_SHORT).show();
});
}