Home > Tricks & Tips > Set line-break in TextView

Set line-break in TextView


A simple trick to set line-break (new-line character insertion) in TextView:

	<TextView
		android:id="@+id/tvContent"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:singleLine="false"
	/>

Now just insert new-line character to have a line-break in your view.

textView.setText("First line \nSecond line \nThird line");

Have fun!

Cheers,
Pete Houston

About these ads
  1. No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

%d bloggers like this: