actionDone imeOption doesn't work on EditText in Android 2.3

寵の児 提交于 2019-11-28 19:06:40

I have resolved this issue. I have added the android:singleLine="true" property and it works right.

<EditText android:layout_height="wrap_content"
    android:layout_width="fill_parent" 
    android:imeOptions="actionDone"
    android:singleLine="true" 
 />
cybergen

Another noteworthy point is that the android:imeOptions don't work if you specify android:digits. Not sure if this affects all android versions.

Currently in Android Studio 2.2.3 if you use

android:singleLine="true"

IDE gives a warning that it has been deprecated use maxlines instead.

android:maxLines="1"

However maxLines does not solve the problem. The solution is to just add the attribute inputType. Example :

<EditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/actionDoneDemo"
    android:layout_below="@id/nameET"
    android:imeOptions="actionDone"
    android:hint="Action Done Demo"
    android:inputType="text"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!