Android - EditText多线强制填充高度

Lor*_*uto 5 android multiline scrollview android-edittext fill-parent

我需要一个EditText来填充窗口的高度.我正在使用这个:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >

<EditText
    android:id="@+id/text_editor"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:background="#ff0000"
    android:gravity="top|left"
    android:inputType="textMultiLine"
    android:textColor="@android:color/white" />

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

但我得到的是一行EditText,一旦我在多行输入返回按钮上写东西,它将更长并可滚动.我知道我可以设置行号,但在这种情况下它应该在不同的设备上工作,每个设备(我猜)有不同的行数.

如何强制它填充设备的高度?

有小费吗?

Ale*_*nko 4

尝试使用(没有ScrollView):

<EditText
    android:id="@+id/text_editor"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:background="#ff0000"
    android:gravity="top|left"
    android:textColor="@android:color/white" />
Run Code Online (Sandbox Code Playgroud)