0

I have an EditText field in my application, where the user can enter data. The application is in fullscreen mode programatically. The problem is that on some phones (Honor P Smart) the "Done" button is not visible anymore, as you can see on the pictures.

This problem appeared just one week ago, after the phone (Honor P Smart) received an update (firmware fig-lx1 8.0.0.140 (c02)).. Before the update the "Done" button was visible. I should mention that the SwiftKey is not the root of the problem, since I tried on other phones with SwiftKey and it worked perfectly.

Also: why is the second one in fullscreen and the first not? How can I force fullscreen?

Here is the xml code for the EditText field:

<EditText 
    android:id="@+id/label" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginEnd="@dimen/margin_left" 
    android:layout_marginStart="@dimen/margin_left" 
    android:cursorVisible="false" 
    android:imeActionLabel="@string/done" 
    android:hint="@string/something" 
    android:imeOptions="actionDone" 
    android:inputType="textVisiblePassword" 
    android:lineSpacingExtra="6sp" 
    android:textColor="@color/color_x" 
    android:textSize="32sp" />

I set the listener in the following way:

view.enar_button_label.setOnEditorActionListener { textView, actionID, keyEvent ->
    if (actionID == EditorInfo.IME_ACTION_DONE) {
        // hiding keyboard, because for some reason, it does not hide automatically
        (activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(view.enar_button_label.windowToken, 0)
        // soome stuff...
        (activity as MainActivity).setImmersiveMode()
        return@setOnEditorActionListener true
    }
    return@setOnEditorActionListener false
}

Honor P smart

Other phones

Any help would be appreciated!

blade
  • 804
  • 1
  • 9
  • 18

2 Answers2

0

Try this:

xml code:


           <EditText
            android:id="@+id/login_email"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_30"
            android:layout_marginRight="@dimen/margin_30"
            android:layout_marginBottom="@dimen/margin_20"
            android:gravity="center"
            android:hint="@string/username"
            android:maxLength="40"
            android:padding="@dimen/padding_10"
            android:imeOptions="actionDone"
            android:singleLine="true" />

add this in EditText

android:imeOptions="actionDone"

java code:


     emailedit = (EditText) findViewById(R.id.login_email);

     emailedit.setImeOptions(EditorInfo.IME_ACTION_DONE);

set line in code

emailedit.setImeOptions(EditorInfo.IME_ACTION_DONE);

I have checked multiple devices its work for me.

i hope it helps you

Android Geek
  • 8,956
  • 2
  • 21
  • 35
  • if you check my question, you can see that android:imeOptions="actionDone" was already in my code – blade Feb 13 '19 at 09:52
0

@blade just add the below line in your edit text tag. Then the problem will be solved.

android:singleLine="true"

Let me know if you face any problems.

Sachin Mandhare
  • 700
  • 2
  • 7
  • 20