codeKiller
codeKiller

Reputation: 5758

Android: add DONE key to soft keyboard deprecated attribute

I am trying to add a DONE key to the soft keyboard so that it will hide when the user is done adding text to an EditText.

The thing is that, from other answers here, I saw that adding the following to the XML file will do the thing:

 android:imeOptions="actionDone"
 android:singleLine="true"

It actually WORKS fine, and the DONE key is showed....however, Android Studio is complaining, telling that android:singleLine="true" is deprecated, use maxLines = 1.

Well, if I change android:singleLine="true" with maxLines = 1 it DOES NOT WORK and the DONE key is not showed.

Am I missing something here?? (Android Studio 2.3.3 I am using)

Upvotes: 1

Views: 240

Answers (1)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

android:singleLine is Deprecated .You should use maxLines with inputType .

android:imeOptions="actionDone"
android:maxLines="1"
android:inputType="text"

Upvotes: 2

Related Questions