Reputation: 1248
I have a question regarding background pictures and android keyboard.
My interface looks like following in the 2 pictures below. Its a search function with a listview beneath it. My problem is, whenever you type in the search-bar (EditText) the keyboard appears and changes the background picture. It looks awful and bloated. How do you tell android not to change the background picture when using keyboard (just make the keyboard slide over the background picture without changing it) ?
How the background should look like: http://tinypic.com/view.php?pic=2nsxowx&s=6
Keyboard changes the background to this mess: http://tinypic.com/view.php?pic=23huck0&s=6
This is my xml file:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_search_task"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/searchable"
android:gravity="center|top"
android:orientation="vertical"
android:stretchColumns="1"
android:weightSum="1.0"
>
<TableRow
>
<EditText
android:id="@+id/searchText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:hint="@string/SearchTaskHint" />
<Button
android:id="@+id/searchButton"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:text="@string/Search" />
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="5dp">
</TextView>
</TableRow>
<TableRow
android:paddingLeft="40dp">
<TextView
android:id="@+id/search_task_column_names"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_weight="0.33"
>
</TextView>
<TextView
android:id="@+id/search_task_column_names1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_weight="0.33">
</TextView>
<TextView
android:id="@+id/search_task_column_names2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textStyle="bold"
android:layout_weight="0.33"
>
</TextView>
</TableRow>
<TableRow
android:paddingLeft="25dp"
android:paddingRight="30dp" >
<ListView
android:id="@+id/search_task_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
/>
</TableRow>
</TableLayout>
Upvotes: 0
Views: 373
Reputation: 10906
The default behavior when the soft keyboard is launched is for the OS to resize your view to fit within the new screen bounds. Since you have a background image the result is it gets pinched up like you are seeing.
See the documentation here on android:windowSoftInputMode The behavior that you want is "adjustPan"
Upvotes: 1
Reputation: 4742
I'm guessing the background of the TableLayout
changes shape with the view. Try setting it as Activity
background and make the background of the TableLayout
transparent.
Note: I'm not sure Activity backgrounds will not resize.
Upvotes: 1