赞
踩
在Android14手机上发现的问题,详见代码
OnEditorActionListener { textView, actionId, event ->
LogUtil.d("insertWord -- actionId:$actionId - event:${event?.action}")
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
//自己的逻辑处理
}
false
}
打印:
searchEditorActionListener$lambda$11(line:370):insertWord -- actionId:3 - event:null
searchEditorActionListener$lambda$11(line:370):insertWord -- actionId:0 - event:0
OnEditorActionListener { textView, actionId, event ->
LogUtil.d("insertWord -- actionId:$actionId - event:${event?.action}")
if (actionId == EditorInfo.IME_ACTION_SEARCH && event?.action != KeyEvent.ACTION_DOWN) {
//自己的逻辑处理
}
false
}
打印:
earchEditorActionListener$lambda$11(line:371):insertWord -- actionId:3 - event:null
earchEditorActionListener$lambda$11(line:371):insertWord -- actionId:3 - event:0
OnEditorActionListener { textView, actionId, event ->
LogUtil.d("insertWord -- actionId:$actionId - event:${event?.action}")
if (actionId == EditorInfo.IME_ACTION_SEARCH && event?.action != KeyEvent.ACTION_DOWN) {
//自己的逻辑处理
true
} else {
false
}
}
打印:
earchEditorActionListener$lambda$11(line:371):insertWord -- actionId:3 - event:null
注意Android12和Android14的打印结果是有差别的!
需要在OnEditorActionListener回调中处理是否消耗事件,自己消耗返回true,否则返回false。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。