Tuesday, 20 August 2013

Android EditText exceeded it's parent viewgroup

Android EditText exceeded it's parent viewgroup


As shown in the above screenshot, the EditText exceeded it's parent, how
to prevent this from happening?
In my chat activity I use a ListView to display messages, each message is
a list item
This is the xml file:
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/form"
android:layout_below="@+id/header"
android:divider="@null"
android:dividerHeight="0dp"
android:padding="5dp" >
</ListView>
And list item:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/avatarLeft"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/border"
android:contentDescription="@string/empty_string"
android:src="@drawable/icon_default_avatar"
android:visibility="gone" /> this will be adjusted
programmatically
<TextView
android:id="@+id/comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" this will be adjusted
programmatically
android:layout_margin="5dp"
android:background="@drawable/none" this will be adjusted
programmatically
android:ellipsize="none"
android:paddingLeft="10dp"
android:singleLine="false"
android:text=""
android:textColor="@android:color/primary_text_light" />
<ImageView
android:id="@+id/avatarRight"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/border"
android:contentDescription="@string/empty_string"
android:src="@drawable/icon_default_avatar"
android:visibility="gone" /> this will be adjusted
programmatically
</LinearLayout>
</LinearLayout>

No comments:

Post a Comment