Android的EDITTEXT问题,更换做过键盘输入 [英] Android Edittext question, replace keypad enter with done

查看:152
本文介绍了Android的EDITTEXT问题,更换做过键盘输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了以下这样一个编辑文本...

I'm defining an edit text like so...

<EditText
android:id="@+id/user"
android:layout_width="200px"
android:layout_height="wrap_content"
android:text="Username"
android:textSize="18sp"
android:gravity="center"
android:layout_x="64px"
android:layout_y="140px"
>

我想,以取代进入按钮键盘上会自动出现,以done按钮只会关闭键盘时,用户点击它。我已经看到了这个工作的一对夫妇的应用程序(如Nexus One的Twitter的应用程序),并想实现类似的东西。没有人知道如何?

I'd like to replace the "enter" button that appears on the keypad automatically, with a done button that would just close the keypad when the user hits it. I've seen this done on a couple of apps (e.g the Nexus One twitter app) and would like to implement something similar. does anyone know how?

也有可能获得默认显示为自动擦除的文字,当用户点击编辑的EditText框? 谢谢你,

Also is it possible to get the text that appears by default to auto erase when the user click to edit the edittext box? Thanks,

推荐答案

简单的解决方案:增加安卓SINGLELINE =真正的的EditText上。这将替换下的输入(对于除了最后一个所有edittexts)和完成(最后一个)。

Simple solution: add android:singleLine="true" for the EditText. This will replace the enter with Next (for all edittexts except the last one) and Done (for the last one).

这篇关于Android的EDITTEXT问题,更换做过键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆