I need a EditText that fills in height my window. I'm using this:
<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>
But all I get is a one line EditText that will be longer and scrollable once I write something on multiline typing the return button. I know I can set the line number, but in this case it should work on different devices and every device (I guess) has different amount of lines.
How can I force it to fill the device in height?
Any tips?
Try to use (without 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" />
Try setting this for EditText, I had the same thing, this will work.
<EditText
android:id="@+id/text_editor"
android:layout_width="match_parent"
**android:layout_height="wrap_content"**
android:background="#ff0000"
android:gravity="top|left"
android:inputType="textMultiLine"
android:textColor="@android:color/white" />
and you can also use this one to set exactly how many lines you need,
android:lines="number of Lines"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With