检测BackSpace单击Android软键盘中的Key_down事件
我已经搜索了接近6个月的搜索,但我无法获得有关如何在EditText视图中单击反戳的正确代码。
使用 setOnKeyListener 并执行if(event.getAction()== keyevent.action_down_down& keycode == keyevent.keycode.keycode_del)
对API 14和API 14不起作用上面,我们无法再回复它。
另外,我得到了一个答案,该答案似乎从在这里,但它仅适用于inputtype.type_null丰富的文本编辑器。我从中得到的所有其他答案都不可靠。
再次使用 textwatcher 不会给我我想要的东西,因为我想在某些情况下返回true
,因此使backspace不删除字符。
我认为可以检测到较高版本的Android中的Android软键盘中的Backspace,因为我在Facebook应用程序中看到了它。此
关于我如何完成此操作的任何想法吗?
I have searched for close to 6 months and I can't get a proper code on how to detect a backspace click in an EditText view.
Using the setOnKeyListener and doing if(event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_DEL)
doesn't work for API 14 and above so we can no longer reply on it.
Also I got an answer which seems to work from here but it only works for InputType.TYPE_NULL and I need it to be a rich text editor. And all other answers I got from SO are not reliable.
And again using TextWatcher won't give me what I want, because I'll want to return true
in some conditions therefore making the backspace not to delete the character.
I think it's possible to detect backspace click in Android soft keyboard in higher versions of Android, because I see it in the Facebook app. This Link is a 4sec video of how it looks on Facebook, and that's the exact same result I want.
Any idea on how I can get this done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论