Quantcast
Channel: Developer Feed - Snippet
Viewing all articles
Browse latest Browse all 178

How to allow multiple line text in EditText view in Android?

$
0
0

The EditText widget by default is single line. In order to allow mutiple lines modify and customize the widget definition in the layout file as below:

<EditText
    android:singleLine="false"<!-- The Default Value is true, change to false -->
    android:lines="8"<!-- The Height of Widget in terms of total Lines  -->
    android:minLines="6"<!-- Minimum number of lines -->
    android:maxLines="10"<!-- Maximum Lines of lines -->
    android:scrollbars="vertical"<!-- Vertical Scroll Bar to visible for easy scrolling -->
    android:gravity="top|left"<!-- Cursor Position in the widget-->
    android:layout_height="wrap_content"<!-- Either Fixed DP or based on the Content Text -->
    android:layout_width="fill_parent"<!--  Either Fixed DP or Span accross parent width -->
/>

read more


Viewing all articles
Browse latest Browse all 178

Trending Articles