简体   繁体   中英

Customize the InputType in EditText android

I have an EditText field in my layout, with the android:inputType="number" . The thing that bothers me is that in the bottom right corner, there is a button saying next , is it possible to customize this to have an Done button here instead which will trigger the keyboard to "go away"?

在此处输入图片说明

在您的xml文件中,将android:imeOptions="actionDone"放入EditText

在您的EditText属性中设置android:imeOptions属性

android:imeOptions="actionDone"

You need to set the android:imeOptions attribute equal to actionDone for Relative EditText as:

<EditText 
    android:id="@+id/edittxt_done"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="Enter text"
    android:imeOptions="actionDone"
    />

Use following code

editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

or android:imeOptions in xml file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM