Android的EDITTEXT问题,更换做过键盘输入做过、键盘输入、问题、Android

2023-09-06 17:43:32 作者:杀尽天下

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

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).