Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android keyboard overlaps ListView

I have a problem, I have a ListView and an EditText designed like this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ShoutboxTab" >

    <ListView
        android:id="@+id/shoutbox"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/shoutbox_field"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="14dp"
        android:layout_marginRight="20dp" >
    </ListView>

    <Button
        android:id="@+id/shoutbox_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@+id/shoutbox_field"
        android:text="Shout" />

    <EditText
        android:id="@+id/shoutbox_field"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/shoutbox_button"
        android:layout_alignLeft="@+id/shoutbox"
        android:ems="10" >

        <requestFocus />
    </EditText>

</RelativeLayout>

So the EditText is under the ListView. When I have items added to the ListView and I click the EditText to type, the keyboard overlaps the bottom part of the ListView. I want to make sure the bottom part of the ListView goes up with the keyboard. Is this possible? Thanks

like image 470
Black Magic Avatar asked Aug 31 '26 11:08

Black Magic


2 Answers

use <activity android:windowSoftInputMode="adjustResize"> in your menifest. second add android:transcriptMode="alwaysScroll" property in your <ListView />

like image 137
Muhammad Aamir Ali Avatar answered Sep 04 '26 07:09

Muhammad Aamir Ali


Are you using <activity android:windowSoftInputMode="adjustResize" ... > in your Manifest? http://developer.android.com/training/keyboard-input/visibility.html

like image 29
Peter Avatar answered Sep 04 '26 07:09

Peter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!