Feona
Feona

Reputation: 295

Multiline EditText

I'm working on a history calculator in which I want the last line of my EditText to move up after each click on the equal button. Is this possible? I set the following code in the main xml

<EditText android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:gravity="center"
        android:singleLine="false" 
        android:lines="5"
        android:layout_marginLeft="10dip" 
        android:layout_marginRight="10dip"/>

Upvotes: 1

Views: 2836

Answers (2)

Shankar Agarwal
Shankar Agarwal

Reputation: 34765

on click event of equals button just have this code

edittext.setText(edittext.getText()+"\n"+your_result_of_calculation);

Upvotes: 1

Som
Som

Reputation: 1544

Uh ! As per your requirement, I think you can do it by appendin ' \n ' to the existing text.

Upvotes: 0

Related Questions