Question

I have a framelayout and I set foreground to it. every thing is fine, but when I chose the textview in top of the frame layout, framelayout foreground scale changes by showing the keyboard. my code is:

`<?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:foreground="@drawable/gol"
android:foregroundGravity="center|center_horizontal"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/rlsearch"
        android:layout_width="fill_parent"
        android:layout_height="48dp"
        android:layout_marginBottom="10dp"
        android:background="@drawable/searchback" >

        <Button
            android:id="@+id/buttonSearch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="5dp"
            android:background="@drawable/search"
            android:focusable="false"
            android:textSize="20sp" />

        <EditText
            android:id="@+id/editTextSearch"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_toLeftOf="@+id/buttonSearch"
            android:background="@android:color/transparent"
            android:hint="@string/HintSearch"
            android:imeOptions="actionSearch"
            android:lines="1"
            android:singleLine="true"
            android:textColor="@color/TextColor"
            android:textColorHint="@color/HintColor" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="fill_parent"
            android:layout_height="100dp"
            android:scaleType="fitXY"
            android:src="@drawable/up" />

        <ListView
            android:id="@+id/DynamicListView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView1"
            android:cacheColorHint="#00000000"
            android:divider="#00000000"
            android:dividerHeight="10dp"
            android:paddingBottom="10dp"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:paddingTop="10dp" >
        </ListView>
    </RelativeLayout>
</LinearLayout>

`

So what's wrong in my code? Thanks

Was it helpful?

Solution

On the activity in your manifest, add the following:

android:windowSoftInputMode="adjustPan"

Explanation: The soft keyboard can either be set to this mode (pan) to scrolls the field we are editing into view alongside the keyboard OR it can be set to scale (the default) which tries to shrink everything so the whole layout still fits with the keyboard visible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top