我只是很好奇为什么记录事件时onEditActionListener会显示两个KeyEvent。
pageNumET.setOnEditorActionListener(new TextView.OnEditorActionListener(){
@Override
public boolean onEditorAction(TextView t, int actionId, KeyEvent event){
if(!(event == null)){
Log.e("ACTIONID", actionId+"");
Log.e("ACTIONEVENT", event+"");
if(event.getAction() == KeyEvent.ACTION_DOWN){
infoText.setText("IT WORKED");
return true;
}
}
return false;
}
}
);
那是代码,它工作正常。 然后,当我在模拟器中按Go时。
已记录:
E/ACTIONID: 66
E/ACTIONEVENT: null
E/ACTIONID: 0
E/ACTIONEVENT: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_ENTER, scanCode=0, metaState=0, flags=0x16, repeatCount=0, eventTime=427524, downTime=427524, deviceId=-1, source=0x0 }
我不知道为什么还有第二场比赛。