Breaking News
Home / Android / Android Snippets / How to allow multiple line text in EditText view in Android?

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

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 –>
/><!>

[pb_builder]

Check Also

How to check if an Android device can connect to Internet?

The following code snippet shows how to check if an Android device can connect to …

Advertisment ad adsense adlogger