I need an activity that look like a simple text editor:
full-screen EditText with submit button below it.
Important:
1. EditText has to scroll both verti
EditText
actually has scrolling already built in, so you don't have to use a ScrollView
. The only thing is that it doesn't support flings.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/some_edittext"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top|left"
/>
<Button
android:id="@+id/submit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit"/>
</LinearLayout>
To stop the automatic wrapping, you can activate horizontal scrolling:
EditText editText = (EditText) findViewById(R.id.some_edittext);
editText.setHorizontallyScrolling(true);
editText.setMovementMethod(new ScrollingMovementMethod());
I think you could set your EditText attribute android:maxLines="1" initially.
And when "new line" button is clicked, you can increase that value programmatically using setMaxLines(int) method.
EditText.setMaxLines(int)
here's the doc -> link
Hope this helped.