Asad Ullah Rafiq
Asad Ullah Rafiq

Reputation: 148

android header become invisible when soft keyboard shown as well as background compress

I'm creating chat application, in the chat screen I have header layout(included), list view and footer layout(included).

When I tap the edit text background of the screen compress and feel very ugly. I used "android:windowSoftInputMode="stateAlwaysHidden|adjustPan" statement in my manifest, Now background does not compress but my whole screen push up that's causes my header is invisible now.

Any idea, through which background do not compress as well as header will remain on the screen

My Screen xml is :``

<include
    android:id="@+id/header"
    layout="@layout/message_header_unlocked"
    android:focusable="true"
     />



<RelativeLayout
    android:id="@+id/list_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/footer"
    android:layout_below="@+id/header"
    android:background="@drawable/main_bg" >

    <include
        android:id="@+id/attachLayout"
        layout="@layout/attachment_view"
        android:visibility="gone" />

    <ListView
        android:id="@+id/msgList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/attachLayout"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="0dp"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:listSelector="@android:color/transparent" />
</RelativeLayout>

<include
    android:id="@+id/footer"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/list_layout"

    layout="@layout/message_footer" />

``

Upvotes: 1

Views: 1086

Answers (1)

Asad Ullah Rafiq
Asad Ullah Rafiq

Reputation: 148

parulb has already answered this question...See this tread to get answer. It's not marked correct by the author of the question.... He quoted that "I faced the same problem while developing a chat app, chat screen with a background image. android:windowSoftInputMode="adjustResize" squeezed my background image to fit the available space after the soft keyboard was displayed and "adjustPan" shifted the whole layout up to adjust the soft keyboard. The solution to this problem was setting the window background instead of a layout background inside an activity XML. Use getWindow().setBackgroundDrawable() in your activity."

Upvotes: 1

Related Questions