Search code examples
androidandroid-layoutandroid-relativelayout

Alignparentbottom=true covers whole screen in relativelayout


I want to create layout like whatsapp messaging layout. Edittext and send icon bottom and list above them. Edittext can multiline and I want to locate icon always bottom (image). But when I make ImageView alignparentbottom=true bottomRl cover the whole screen (image).

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

         // recyclerview here , above the bottom view 

          <RelativeLayout
                android:id="@+id/bottomRl"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true">

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:src="@drawable/ic_test" />

            </RelativeLayout>
    </RelativeLayout>

Is this android bug or I make something wrong?

Thanks for answers

Solution ...

<ImageView
            android:id="@+id/imageViewSend"
            android:layout_width="36dp"
            android:layout_height="36dp"
            android:layout_alignBottom="@+id/editTextEntry"
            android:layout_alignParentEnd="true"
            android:src="@drawable/ic_send" />

Solution

  • try like this:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <android.support.v7.widget.RecyclerView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <RelativeLayout
            android:id="@+id/bottomRl"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true">
    
            <EditText
                android:id="@+id/editTxt"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toStartOf="@id/imageV"
                android:text="vsdvsvsvsv c xc x x xdfbdcx  fv"/>
    
            <ImageView
                android:id="@+id/imageV"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:src="@mipmap/ic_launcher" />
    
        </RelativeLayout>
    </RelativeLayout>