0

How can I expand my Listview when I close the Softkeyboard or open it again ? My Listview is currently full screened.

Problem: When I want to scroll to the last item of my ListView I have to close Softkeyboard first because the Softkeyboard is hiding it (so its under the softkeyboard) , and thats kinda annonying.

I found an example ,what I want to achieve, in the android music player search function which looks like this when I open and close it (See scrollbars)

When Softkeyboard is closed When its opened

Is there a way without much hacks ? I allready tried this in my manifest :

android:windowSoftInputMode="adjustResize"

but this didnt helped.

EDIT: My Layout:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/listview_background">

    <RelativeLayout
        android:id="@+id/RelativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@color/colorPrimary"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/editText_searchbox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/imageView_btn_back"
            android:ems="10"
            android:hint=" Search"
            android:singleLine="true"
            android:textColor="#FFFFFF"
            android:drawableBottom="#FFFFFF"
            android:textColorHint="#FFFFFF" >

            <requestFocus />
        </EditText>

        <ImageView
            android:id="@+id/imageView_btn_back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/editText_searchbox"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/editText_searchbox"
            android:src="@drawable/ic_chevron_left_white_48dp" 
            android:onClick="btn_back"/>

    </RelativeLayout>

    <ListView
        android:id="@+id/listView_results"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:fastScrollEnabled="true"
        android:smoothScrollbar="true"
        android:focusable="false"
        android:drawSelectorOnTop="true"
        android:gravity="top"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:layout_below="@+id/RelativeLayout1">
    </ListView>

</RelativeLayout>
Ahmet K
  • 713
  • 18
  • 42

1 Answers1

0

With zgc7009 help I found out that the adjustResize only works when the layout is NOT in fullscreen mode. That solved everything by changing my AppTheme style.

If someone knows how to use adjustResize with fullscreen mode let me pls know.

Thanks again to zgc7009 !

Ahmet K
  • 713
  • 18
  • 42