如何在android中当前焦点编辑文本?
您好,我想要编辑当前焦点位于按钮单击的文本,有任何按钮可以执行此操作。
或者,如果活动中有许多编辑文本,则有一种方法可以识别最后修改的编辑文本。
请向我推荐可用的链接或示例代码。
Hi i want to get edit text which is currently focus at button click , there is any button to doing it .
Or there is a way to identify which edittext is last modified if there are many edit text in activity.
Please suggest me usable link or sample code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我采用线性布局并向其中添加自定义 EditText。
这里mEditText是一个全局变量。
您可以在活动中的任何位置访问它。并且可以获得你最后写入的editText是什么。
I take a linear layout and add custom EditText into it.
Here mEditText is a global variable.
Anywhere in your activity you can access it. And can get what's the last editText you have written into.
您可以向所有 EditText 添加一个 textWatcher:
并且可以在您的类中添加一个全局变量来包含正在编辑的 editText 引用。
you can add a textWatcher to all EditTexts:
and can have a global variable to your class to contain editText reference, which is being edited.