How to use more then one imeOptions in android

泄露秘密 提交于 2019-12-08 02:09:40

问题


Is it possible to use more then 1 imeOptions in Android xml ? for the same text field.

e.g.

<EditText
    android:id="@+id/mywriting"
    android:imeOptions="actionDone"
    android:imeOptions="autoText"/>

Right now it is giving me an error, saying 1 imeOptions has already been used and I can't use any more


回答1:


Use | to combine, like that:

android:imeOptions="actionDone|actionNext"

In your case, the problem is with autoText, which is not a valid value for imeOptions.




回答2:


<EditText
android:id="@+id/mywriting"
android:imeOptions="actionDone|autoText" />

ERRATUM

My bad. It is the inputType not the imeOptions that can be combined.

<EditText
android:id="@+id/mywriting"
android:inputType="..."
android:imeOptions="actionDone" />


来源:https://stackoverflow.com/questions/27295749/how-to-use-more-then-one-imeoptions-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!