I have a simple layout, shown below:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="200dp"
android:fadeScrollbars="false"
android:gravity="center_vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.2" />
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<EditText
android:layout_width="match_parent"
android:layout_height="290dp"
android:ems="10"
android:gravity="top" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit"/>
</LinearLayout>
</RelativeLayout>
Basically, there is a TextView
inside of a ScrollView
that states a question, and I want the user to type the answer inside the EditText
.
In my AndroidManifest
, I've included the following:
<activity
android:screenOrientation="portrait"
android:windowSoftInputMode="???" >
</activity>
Where the "???" is, I've tried using the following: adjustPan
, adjustResize
, and adjustPan|adjustResize
.
With adjustPan
and adjustResize
, I'm experiencing the same thing: when I type and the text gets out of view, the screen automatically scrolls down so the keyboard doesn't cover the text being typed. The problem here, however, is that when I try to highlight the typed text to select all, copy, cut, or paste, the copy/cut/paste menu bar that normally appears on top can't be reached because it's been scrolled out of view. If I try to manually reach that menu bar, then the text no longer gets highlighted.
With adjustPan|adjustResize
, the copy/cut/paste menu bar stays happily within view and within reach, but if I type too much, the typed text eventually gets obscured by the keyboard.
So how can I still type where the typed text never gets obscured, and still have the copy/cut/paste menu bar follow along and allow me to make occasional edits as needed?