I am setting following string as a input for my txtMessage :
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.breaknotification);
TextView txtMessage = (TextView)findViewById(R.id.txtMessage);
String msg = "TIME RECORD VALUE\n" +
"10 AM 1 20\n"+
"11 AM 2 30\n"+
"12 PM 3 40";
txtMessage.setText(msg);
}
my breaknotification.xml file is as per following:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text=""
android:textColor="#FFFFFF"
android:textSize="21sp"
android:textStyle="bold" />
</LinearLayout>
and I want to print my string as per following format.
TIME RECORD VALUE
10 AM 1 20
11 AM 2 30
12 PM 3 40
But it is not showing me exactly what I want; it shows me following in my message,
TIME RECORD VALUE
`10 AM 1 20`
`11 AM 2 30`
`12 PM 3 40`
So how can I achieve it?
I found the following solution :
added textView property : android:typeface=”monospace”