Search code examples
androidandroid-layoutkeyboardandroid-edittext

Android Soft Keyboard freezes visible layout until closed


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>

Solution

  • 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?