4

I have a bunch of EditText's inside a LinearLayout inside a ScrollView. When I click on one of them, soft keyboard appears normally, and my EditText appears focused. But when I type, the text doesn't show up. Not even cursor is showing. When I tap another EditText, or a Button that should make a visible change (add views), or click Next on the keyboard, nothing visually changes. But once I close the keyboard (with Back button or programmatically), I can finally see changes: typed text appears and desired EditText is selected.

As if everything works correctly, only the screen is frozen until I close soft input, and then I can see progress.

Why is this happening and how do I fix it? Closing the keyboard programmatically can't pass because I need Next button on the keyboard to work, and constant opening/closing makes my UI look confusing.

My EditText's are all like this and are different from each other only by ID and Hint.

<EditText
    android:id="@+id/dataFullName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:hint="Personal name"
    android:inputType="textNoSuggestions|textPersonName|textVisiblePassword"
    android:textColor="#FFFFFF" />

This is ScrollView holding the LinearLayout that's holding my EditText

<ScrollView
    android:id="@+id/generalsScrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >


        <!-- my EditText's here -->


        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:text="Additional information:"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@android:color/white"
            android:textSize="@dimen/additional_text" />

        <LinearLayout
            android:id="@+id/generalsContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/additional_margin"
            android:orientation="vertical" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/generalsAdder"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <Button
                android:id="@+id/newGeneralButton"
                android:layout_width="96dp"
                android:layout_height="32dp"
                android:layout_gravity="center_horizontal"
                android:layout_weight="1"
                android:background="@drawable/bttn_bg"
                android:onClick="newGeneralButtonPressed"
                android:text="Add"
                android:textColor="@android:color/white"
                android:textColorHint="@android:color/white"
                android:textColorLink="@android:color/white" />
        </LinearLayout>
    </LinearLayout>
</ScrollView>
Bugs Happen
  • 2,169
  • 4
  • 33
  • 59
cruelcore1
  • 578
  • 4
  • 22
  • Thank you for facing this problem before me and putting a question and an answer to this problem. Let me try it your way.. – Bugs Happen Jul 01 '19 at 09:48

2 Answers2

2

I've just solved my problem again. There were too many EditText's in the same LinearLayout. So I just divided them in 2 LinearLayout's and now it's good. Does anyone have the idea why that's happening?

cruelcore1
  • 578
  • 4
  • 22
  • It didn't help. I only have two `EditText`s. Also for me, this problem arises when `EditText` are near to the bottom of phone and keyboard has to move them to top to be displayed above keyboard. It doesn't arise when `EditText` is already on the top and nothing moved on keyboard appearance. Also this only happens in Android 9, not in previous versions. – Bugs Happen Jul 02 '19 at 05:32
1

For me, the problem was in only Android 9 Pie, and it got fixed by setting android:hardwareAccelerated="true".

Here is the reference to that solution.

Bugs Happen
  • 2,169
  • 4
  • 33
  • 59