我有一个编辑文本,定义如下。Android:编辑文本开始按钮
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:inputType="text"
android:hint="@string/field_text"
android:id="@+id/field"
/>
我想,这样当有人点击该完成/启动按钮在屏幕键盘上点击一个按钮来设置自定义命令或只是运行由该按钮运行方法。我认为这与ime选项有关,但我一直无法弄清楚它们是如何工作的。预先感谢任何帮助!
只是想跟进这个答案,并提到这并不一定适用于所有设备。例如,我将我的OnKeyListener代码更改为在我的应用程序中使用OnEditorActionListener,突然我的HTC Evo停止执行该操作。看到这个更多的信息:http://stackoverflow.com/questions/3886677/imeoptions-on-htc-devices – Dan 2011-05-13 20:32:31
很好的例子.... – AndroidDanger 2011-06-08 07:03:33
但使用这个例子,你不能创建多行editext.Like聊天文本,在这个你添加的文本不是Wrodwrap automaticaly。 – 2014-01-01 04:50:03