actionDone imeOption doesn't work on EditText in Android 2.3

前端 未结 3 896
臣服心动
臣服心动 2020-12-14 00:39

I have a problem using an EditText in Android 2.3.

I have an EditText defined with android:imeOptions=\"actionDone\" property

相关标签:
3条回答
  • 2020-12-14 00:56

    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" 
     />
    
    0 讨论(0)
  • 2020-12-14 00:57

    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"/>
    
    0 讨论(0)
  • 2020-12-14 01:03

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

    0 讨论(0)
提交回复
热议问题