-5

Possible Duplicate:
how do i create a multiline string in EditText?

i want to display a string in a multiline EditText. Currently, the string displays as....

Receive: 0 coin(s) Total
             Cost: $100

I want want it to display as...

Receive: 0 coin(s) 
Total Cost: $10

This is my code, I have tried to use "\n", but to no avail...

result.setText("Receive:"+ " "+ df.format(rawounces)+"coin(s)" + "\n" 
     + "Total Cost:$" + df.format(transactionandpremium*rawounces));

Thank you in advance.

Community
  • 1
  • 1
B. Money
  • 931
  • 2
  • 19
  • 56

1 Answers1

0

You can use the Html attribute to set text as you want as ::

<EditText
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   />

String str="Receive: 0 coin(s) <br> Total Cost: $10";
editText.setText(Html.formHtml(str));  
Haresh Chaudhary
  • 4,390
  • 1
  • 34
  • 57