ahmad
ahmad

Reputation: 1252

Keyboard hides EditText when selected

I am facing an issue where the keyboard hides an editText when the editText is selected for the second time, the first time editText is selected the keyboard behaves as expected.

The issue only occurs when I set the editText input type to "NumberDecimal" but when it's set to "Default" the keyboard behaves normally as well.

I have tried the following without success:

android:windowSoftInputMode=“adjustResize"

below is a snippet from the layout file

 <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:layout_marginTop="20dp"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:weightSum="1">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_gravity="center"
                    android:layout_marginLeft="10dp"
                    android:layout_weight="0.25"
                    android:background="@drawable/rounded_left_selected"
                    android:gravity="center"
                    android:text="@string/amount"
                    android:textColor="@color/white"
                    android:textSize="17dp"

                    android:textStyle="bold" />

                <EditText
                    android:id="@+id/transfer_amount"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="0.55"
                    android:background="@drawable/white_unrounded_edittext"
                    android:ems="10"
                    android:gravity="center"
                    android:hint="@string/hint_amount"
                    android:maxLength="15"
                    android:textColor="@color/blue_light"
                    android:textSize="17dp"
                    android:inputType="numberDecimal"/>

                <TextView
                    android:id="@+id/trans_amount_cur"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.12"
                    android:background="@drawable/round_right_selected"
                    android:gravity="center"
                    android:text="JOD"
                    android:textColor="@color/white"
                    android:textSize="17dp" />
            </LinearLayout>

Upvotes: 0

Views: 612

Answers (2)

Sadiq Mamedov
Sadiq Mamedov

Reputation: 51

You can add android:windowSoftInputMode="adjustPan" in you manifest, into activity. I thing it is the best way

Upvotes: 1

Thair Jaber
Thair Jaber

Reputation: 117

Just remove the gravity on edittext, it seems to be a bug.

<EditText
                android:id="@+id/transfer_amount"
                android:layout_width="0dp"
                android:layout_height="fill_parent"
                android:layout_weight="0.55"
                android:background="@drawable/white_unrounded_edittext"
                android:ems="10"
                android:hint="@string/hint_amount"
                android:maxLength="15"
                android:textColor="@color/blue_light"
                android:textSize="17dp"
                android:inputType="numberDecimal"/>

Upvotes: 1

Related Questions