使用按钮输入 EditText
所以我隐藏了软键盘,因为我只希望“1”和“0”作为输入按钮和删除按钮。我有两个 EditText 框。如何让用户单击编辑框并能够让这些按钮仅在该框中键入内容?与删除相同。我只需要知道如何让它识别您选择了该框。 获取其中的内容并将“0”添加到字符串末尾。
谢谢
So I hid the soft keyboard because I only want "1" and "0" to be the buttons to type with and a delete button. I have two EditText boxes. How do I go about letting the user click on the EditBox and be able to have those Buttons only type in that box? and same with the delete. I only need to know how to make it recognize that you have chosen that box. Take whats there and add "0" to the end of the string.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您要查找的只是获取选定的 EditText,请对每个 EditText 使用
hasFocus()
方法。该方法根据是否具有焦点(已被用户选择)返回一个布尔值。然后将文本插入具有焦点的 EditText 中。如果这没有帮助,我以前做过类似的事情,可以为您提供不同的解决方案。
If all you are looking for is to get the EditText that is selected, then use the
hasFocus()
method on each EditText. The method returns a Boolean value depending on whether or not it has focus (has been selected by the user). Then insert your text into the EditText that has focus.If this does not help, I've done something similar to this before and can offer you a different solution.