Android:EditText没有填充ScrollView和RelativeLayout

Byt*_*yte 6 android scrollview relativelayout android-edittext

我一直试图用ScrollView包装我的editText,以便在内容更新时自动滚动它.我发现EditText不会覆盖整个滚动视图的问题,即使宽度和高度都设置为fill_parent.请赐教.谢谢.

这是代码:

<?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>
Run Code Online (Sandbox Code Playgroud)

Pho*_*non 24

尝试添加android:fillViewport="true"ScrollView属性.这应该使它在每次内部变化时调整其大小.另外,android:layout_height=wrap_content用于EditText.填充本身可以重新调整大小的父级是没有意义的