xamarin.android editor enter事件处理
下述方法可行:
editText = FindViewById(Resource.Id.editText); editText.KeyPress += (object sender, View.KeyEventArgs e) => { e.Handled = false; if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) { //your logic here e.Handled = true; } }; 上述代码中通过e.Event.Action == KeyEventActions.Down 避免了 your logic 触发两次的问题;若没有它,你的逻辑将执行多次。
赞 (0)