tags:

views:

72

answers:

3

I have edittext and a button below edittext. edittext has width as fill_parent and height as wrap_content.

My messages covers full screen, due to this my button is not visible it hides below virtual keyboard

can any one sort this problem. Thanks.

alt text alt text

A: 

Try inserting this in your layout file where your edittext is called out:

  android:layout_above="@+id/ID OF YOUR BUTTON HERE"

Also, your button at the bottom may require:

android:layout_alignParentBottom="true"
How do you know he is using `RelativeLayout`?
Cristian
A: 

Assuming you WANT the EditText to cover all of the screen except for the button...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <EditText
        android:id="@+id/myedittext"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" />
    <Button
        android:id="@+id/mybutton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="this is my button"/>
</LinearLayout>
Andrew
+1  A: 

I've had the most success with something similar, but not identical to, Andrew's solution:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <EditText
        android:id="@+id/myedittext"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
    <Button
        android:id="@+id/mybutton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:text="this is my button"/>
</LinearLayout>
beekeeper
Does Andrew's solution work?! Yours seems much better to me, but what about virtual keyboard?!
Mur Votema
The "effective screen size" will shrink to allow for the virtual keyboard, and the remaining space will be arranged according to the same layout. The keyboard will show up, the button will demand it's space, and the EditText will get whatever is left, which might not be much.
beekeeper
it sounds nice, I should try it on monday :)
Mur Votema