android:lines - Change the number of lines of text viewable in a TextView/EditText

How to Change the number of lines of text viewable in a TextView/EditText

android:lines was added in API Level 1.

Makes the TextView be exactly this many lines tall.Must be an integer value, such as "10".

1. Add 3 EditTexts in your main.xml file.

2. In the main.xml file, add the code below.
    These are examples with 1) No lines included. (so all text is displayed on as many lines as it takes) 2) lines = 1.5 3) lines = 3


<EditText
                ...  
android:text = "not included. This is text. This is text. This is text. This is text.This is text.  This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text." />

    <EditText
           ...
android:text = "1 -  This is text. This is text. This is text. This is text.This is text.  This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text."
        android:lines = "1" />

    <EditText
                ...
android:text = "3 - This is text. This is text. This is text. This is text.This is text.  This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text."
android:lines = "3"        />


3. Compile and run!

Related Articles: