androidlayoutdialogsoft-keyboard

Dialog is partially shown when SoftKeyBoard is shown


I have a custom Dialog as shown below:

enter image description here

When I click on the Edit Text, The dialog is shifted upwards but half of the dialog becomes invisible as shown below: enter image description here

I verified the issue on Android ICS and Gingerbread but it doesn't happen on Android Lollipop.

I appreciate your help for figuring out why.

Here is the custom dialog layout XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutChatInGame"
android:layout_width="305dp"
android:layout_height="190dp"
android:background="@drawable/dialog_table_border"
android:orientation="vertical"
android:visibility="visible">

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/roomlist_title_background">

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progressBar"
        android:layout_margin="5dp"/>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:layout_margin="5dp">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="Game is on hold because the host paused the app"
                android:id="@+id/lblOnHoldDialogMessage"
                android:textColor="@color/progress_dialog_on_hold_text"
                android:textSize="18dp"
                android:singleLine="false"
                android:layout_gravity="center_horizontal"/>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

<TextView
    android:id="@+id/lblChatHistoryGameOnHold"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="bottom"
    android:maxLines="5"
    android:scrollbars="vertical"
    android:textColor="@color/edit_text_general_text"
    android:textColorHint="@color/edit_text_general_hint"
    android:paddingRight="2dp"
    android:paddingLeft="2dp"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/textChatGameOnHold"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="2dp"
        android:layout_marginStart="2dp"
        android:layout_weight="1"
        android:ems="10"
        android:hint="@string/edit_text_send_chat_message"
        android:imeOptions="flagNoExtractUi|actionDone"
        android:inputType="text"
        android:maxLength="100"
        android:maxLines="1"
        android:textColor="@color/edit_text_general_text"
        android:textColorHint="@color/edit_text_general_hint"/>

    <Button
        android:id="@+id/btnSendGameOnHold"
        style="@style/lightboxButton.Blue"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="sendChatMessageInGame"
        android:text="@string/btn_send"/>
</LinearLayout>

</LinearLayout> 

Solution

  • Try to use also android:imeOptions="flagNoFullscreen" in your .xml. Recommend you to make some tests, using it with and without flagNoExtractUi. Please give me some feedback.