Relativelayout not wrapping its content

Bilal Haider

I want my inner RelativeLayout to wrap it's content and stay below the View element. Why isn't it behaving like the pic below?

My layout.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <View
        android:id="@+id/linearLayout"
        android:layout_above="@+id/input_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <RelativeLayout
        android:id="@+id/input_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="#ebebeb">

        <EditText
            android:id="@+id/editText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_toLeftOf="@+id/imageView13"
            android:layout_toStartOf="@+id/imageView13"
            android:background="@android:color/white"
            android:padding="8dp" />

        <ImageView
            android:id="@+id/imageView13"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:src="@drawable/ic_m_send" />

    </RelativeLayout>

</RelativeLayout>

enter image description here

Ravi

remove android:layout_alignParentBottom="true" from both your EditText and ImageView will solve your proble.

Your RelativeLayout already have android:layout_alignParentBottom="true" and if you will set same for it's child also it will set layout height to full screen.

Note that you cannot have a circular dependency between the size of the RelativeLayout and the position of its children. For example, you cannot have a RelativeLayout whose height is set to WRAP_CONTENT and a child set to ALIGN_PARENT_BOTTOM

Class Document

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Center RelativeLayout or its contents

From Dev

LinearLayout not wrapping content

From Dev

Wrapping content height on a SnackBar

From Dev

Linear Layout not wrapping content

From Dev

Wrapping only the visible content

From Dev

RelativeLayout background drawable overlap content

From Dev

ScrollView overlapping other content in RelativeLayout

From Dev

Wrapping a function hides its attributes?

From Dev

Wrapping a function hides its attributes?

From Dev

bootstrap responsive table content wrapping

From Dev

wrapping child node content in xquery

From Dev

floating ajax content not wrapping as wanted

From Dev

wrapping Wordpress text content in div

From Dev

Wrapping Wordpress text content in .class

From Dev

MVVMCross - MvxGridView is not wrapping the content height

From Dev

"LinearLayout or its RelativeLayout parent is useless" warning

From Dev

Adding a View to RelativeLayout changes its size

From Dev

"This RadioGroup layout or its RelativeLayout parent is possibly useless"

From Dev

targeting an element by its content and the content of its ancestors

From Dev

wrapping some content except the first element

From Dev

Bootstrap: horizontally centered contents in rows with wrapping content

From Dev

Stop text wrapping around css genareated content?

From Dev

Prevent content from wrapping around floated element

From Dev

Conditionally wrapping <content> insertion points in Polymer

From Dev

Stop div from wrapping around content?

From Dev

Stop text wrapping around css genareated content?

From Dev

wrapping some content except the first element

From Dev

Wrapping an entire set of dynamic content with a div

From Dev

Wrapping ember.js body content in div

Related Related

HotTag

Archive