我向ListView
添加了一个关键监听器,代码如下:
ListView listView = (ListView) findViewById(R.id.list);
List<String> lists = new ArrayList<String>();
lists.add("item1");
lists.add("item2");
lists.add("item3");
lists.add("item4");
ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,
lists);
listView.setAdapter(adapter);
listView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
return true; // here if I return true, the list view can not move focus
//return false; // if I return false, the list view can move focus
}
});
我想知道为什么会这样?