-2

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.

B. Money
  • 931
  • 2
  • 19
  • 56
  • you can use to different text view for receive and total cost!! – KMI Jul 25 '12 at 04:36
  • possible duplicate of [Allow multiline in EditText view in android?](http://stackoverflow.com/questions/4233626/allow-multiline-in-edittext-view-in-android) – Jim G. Jun 10 '13 at 16:17

1 Answers1

1

You can use the android:minLines="3" for display the multiline in edittext. and for display cursor on the top of the edittext you can use like android:gravity="top."

<EditText
            android:id="@+id/edittext"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:minLines="3"
            android:maxLines="5"
            android:gravity="top"
            android:inputType="textMultiLine" />
Rahul Patel
  • 3,823
  • 5
  • 30
  • 46