1.TreeView选择事件执行两次 Very often, we need to execute some code in SelectedItemChanged depending on the selected TreeViewItem. ButSelectedItemChanged is called twice. This is due to stealing focus from the main window, which is screwing something up. Wha…
Android的EditText通过setOnEditorActionListener给文本编辑框设置监听事件,但是在其处理方法onEditorAction中的逻辑在每次回车后都触发了两次, 原来是在键盘回车的ACTION_UP和ACTION_DOWN时都会触发这个方法,因此修改代码如下,就防止了两次执行: public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //以下方法防止两次发送请求 if (ac…