Archive

Posts Tagged ‘coding’

Take a screenshot of your View


Quick snippet

    View content = findViewById(R.id.layoutroot);
    Bitmap bitmap = content.getDrawingCache();

Cheers,
Pete Houston

Set line-break in TextView

July 15, 2011 2 comments

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