android - How to keep some of the components fixed when the soft keyboard comes in? -
my application chat application, , ui is:
header of app
list view
chat message, input box, , send button
but problem when click edit text, soft keyboard comes , pushes up, need header stay on screen. i've attached simplified problem images , ui code here. (i can't post multiple links or images in post because i'm new stack overflow.)
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <textview android:text="header contents" android:layout_width="fill_parent" android:textsize="20sp" android:gravity="center_horizontal" android:layout_height="wrap_content" /> <listview android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" /> <edittext android:text="" android:layout_gravity="bottom" android:id="@+id/edittext01" android:layout_width="fill_parent" android:layout_height="wrap_content"></edittext> </linearlayout>
android has requirement in default messaging app.
does have ideas?
the question quite old, anyhow - 1 way fix put comes below header within scrollview.
example:
<!-- both elements below children of parent relativelayout --> <relativelayout android:id="@+id/custom_action_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:isscrollcontainer="false" > <!-- header goes here. --> <!-- part remains fixed keypad popping up. --> </relativelayout> <scrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/custom_action_bar" android:isscrollcontainer="true" > <!-- rest of ui --> <!-- part scrolls accommodate keyboard --> </scrollview>
Comments
Post a Comment