简体   繁体   English

Edittext文本输入侦听器

[英]Edittext text input listener

Am developing an android chat application. 正在开发一个android聊天应用程序。 Everything works well but except for one thing; 一切正常,但只有一件事。 I want to set the visibility of a layout to gone and then set a different layout to visible when user starts typing in the edittext like the one implemented on whatsapp. 我想将布局的可见性设置为“消失”,然后在用户像在whatsapp上实现的那样开始输入edittext时将另一种布局设置为可见。 But I cant seem to figure it out. 但我似乎无法弄清楚。 Any help will be appreciated 任何帮助将不胜感激

Basically, what I want to do is set the visibility of a layout which contains an image button to upload image to gone and then show a layout which contains an image button to send the message or text in the edittext to visible when the user starts typing 基本上,我想做的是设置包含图像按钮的布局的可见性,以上传图像,然后显示包含图像按钮的布局,以在用户开始输入内容时将消息或文本发送到edittext中

Can you explain in detail? 你能详细解释一下吗? Do you wan edit text to come up when keyboard is hoped up. 当希望键盘按下时,您是否希望编辑文本以显示出来。 then use below in your manifest. 然后在清单中使用以下内容。

<activity
        android:name=".Activityname"

        android:windowSoftInputMode="adjustPan">

If not, then please explain your question in more detail 如果没有,请更详细地解释您的问题

Take a look at the TextChangedListener . 看一下TextChangedListener With help of the TextWatcher you should be able to run commands when the input changes. 借助TextWatcher,您应该能够在输入更改时运行命令。

Please describe in more detail, if you need further assistance. 如果您需要进一步的帮助,请更详细地描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM