我需要一个填充窗口高度的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>
但是我得到的只是一个单行EditText,一旦我使用多行输入并按下回车键,它就会变得更长并可滚动。我知道我可以设置行数,但在这种情况下,它应该适用于不同的设备,每个设备(我猜)具有不同数量的行。
我如何强制它填充设备高度?
有什么提示吗?