Android: EditText does not populate ScrollView and RelativeLayout

I am trying to collapse my editText using a ScrollView to automatically scroll it when the content is updated. I found that EditText does not cover the entire view of the scroll, even with the width and height set to fill_parent. Please enlighten me. Thank.

Here is the code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="send"
/>
<EditText
android:id="@+id/msgBox"
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:layout_alignParentBottom="true" 
android:layout_toLeftOf="@+id/sendButton"
android:gravity="left"
android:longClickable="false"
/>
<ScrollView
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:layout_above="@+id/msgBox">
<EditText  
android:id="@+id/chatBox"
android:editable="false" 
android:gravity="left|top" 
android:cursorVisible="false" 
android:longClickable="false" 
android:clickable="false"
android:autoLink="all" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"/>
</ScrollView>
</RelativeLayout>
+5
source share
1 answer

android:fillViewport="true" ScrollView. , - . , android:layout_height=wrap_content EditText. ,

+21

All Articles