how to set text new line in Toast at center android

Noisyman picture Noisyman · May 24, 2016 · Viewed 11.1k times · Source

My Toast have 3 lines, I want line 2 and 3 show center of this toast and set duration to 10 seconds.

How can do it?

Like this picture:

enter image description here

Answer

Shlomi Fresko picture Shlomi Fresko · Feb 6, 2017

\n inside the string works!!!

Toast.makeText(this, "line1\nLine2", Toast.LENGTH_SHORT).show();