Pol Hallen
Pol Hallen

Reputation: 1862

edittext goes above buttons

enter image description hereI tried many many times but nothing... I've a image on top of screen, an editext and 2 buttons. Filling edittext, that goes above buttons and users can't click on "send" or "cancel". I tried also use "scrollview" but I've same problem.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/inviabackground2"
android:orientation="vertical"
android:layout_weight="1"
tools:context=".MainActivity" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/logoinvia" />

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

</LinearLayout>

            <EditText
                android:id="@+id/editText1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10" >

</EditText>

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="bottom"
    android:layout_weight="1"
    android:orientation="horizontal" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Invia per mail!" />

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center_vertical|center_horizontal"
                android:text="Annulla" />

</LinearLayout>
</LinearLayout>

Upvotes: 0

Views: 307

Answers (3)

Nipun Gogia
Nipun Gogia

Reputation: 1856

here is your solution :

![<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="1" xmlns:android="http://schemas.android.com/apk/res/android">

     <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_alignParentTop="true"
            android:src="@drawable/ic_launcher" />


<ScrollView 
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="0.50"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="bottom"
        android:orientation="vertical" >



        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView1"
            android:ems="10" >
        </EditText>


    </LinearLayout>

</ScrollView>

<LinearLayout 
    android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="0.50"
            android:gravity="center"
            android:weightSum="1">

    <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_alignParentLeft="true"
            android:text=" mail!" 
            android:layout_weight="0.50"/>

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_toRightOf="@id/button1"
            android:layout_alignParentRight="true"
            android:text="xyz" 
            android:layout_weight="0.50"/>

</LinearLayout>

</LinearLayout>

enter image description here

Upvotes: 0

Nipun Gogia
Nipun Gogia

Reputation: 1856

here is the layout :

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="1" xmlns:android="http://schemas.android.com/apk/res/android">


<ScrollView 
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_weight="0.30"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="bottom"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_alignParentTop="true"
            android:src="@drawable/ic_launcher" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView1"
            android:ems="10" >
        </EditText>


    </LinearLayout>

</ScrollView>

<LinearLayout 
    android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="0.70"
            android:gravity="center"
            android:weightSum="1">

    <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_alignParentLeft="true"
            android:text=" mail!" 
            android:layout_weight="0.50"/>

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_toRightOf="@id/button1"
            android:layout_alignParentRight="true"
            android:text="xyz" 
            android:layout_weight="0.50"/>

</LinearLayout>

</LinearLayout>

Upvotes: 0

Stephan
Stephan

Reputation: 1868

This works for me. It scrolls down as the user types.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="bottom"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_alignParentTop="true"
            android:src="@drawable/ic_launcher" />

        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView1"
            android:ems="10" >
        </EditText>

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_alignParentLeft="true"
            android:text="Invia per mail!" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/editText1"
            android:layout_toRightOf="@id/button1"
            android:layout_alignParentRight="true"
            android:text="Annulla" />
    </RelativeLayout>

</ScrollView>

Upvotes: 1

Related Questions