title: Android EditText in ScrollView pans to the top when more text is inserted
body: <p>I have an <code>EditText</code> inside a <code>LinearLayout</code> which resides inside a <code>ScrollView</code>. Underneath the <code>EditText</code> are a bunch of <code>TextViews</code> to fill up the screen (and beyond). The <code>EditText</code> has a <code>layout_height</code> of 100dp so that it has room for a few lines of text.</p>
  
  <p>Now when i start typing in the <code>EditText</code> and hit "enter" to add a new line after a couple of lines the entire layout (including the <code>ScrollView</code>) start to pan to the top until the entire <code>EditText</code> is not visible anymore.</p>
  
  <p><img src="https://i.stack.imgur.com/3sBGM.png" alt="Content should not pan upwards"> </p>
  
  <p>Apparently the "panning" towards the top starts when the "virtual" height of text inside the <code>EditText</code> (the View bounds remain 100dp high) reaches a certain threshold.</p>
  
  <p>On the activity i have set <code>android:windowSoftInputMode="adjustPan"</code> but a similar problem occurs with <code>adjustResize</code>.</p>
  
  <p>I have also tried to play around with the <code>android:isScrollContainer="false"</code> on the ScrollView or the various min and max properties on the <code>EditText</code> but nothing did help</p>
  
  <p>Here is the layout:</p>
  
  <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
      &lt;LinearLayout
          android:id="@+id/main_content"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:text="Hallo World!"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" /&gt;
  
          &lt;EditText
              android:text="I am an EditText"
              android:layout_width="match_parent"
              android:layout_height="100dp"
              android:gravity="top|start" /&gt;
  
          &lt;TextView
              android:text="Hallo World!"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" /&gt;
  
          &lt;TextView
              android:text="Hallo World!"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" /&gt;
  
          ... many more text views ...
  
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Does anybody know how i could prevent the entire layout from panning upward when entering text with new lines into the <code>EditText</code>?</p>