我有一个带有列表的 ListFragment,没有单击。但是可以识别长点击。
ListView listView = getListView();
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Log.i(null, "single click does NOT work.");
}
});
// contextual action bar (CAB).
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
Log.i(null, "does work.");
}
});