title: Android TextInputLayout writing focus issue when height is bigger than the screen
body: <p>I have a TextInputLayout like this:</p>
  <pre><code>&lt;com.google.android.material.textfield.TextInputLayout
          android:id=&quot;@+id/textInputLayout&quot;
          style=&quot;@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:minHeight=&quot;200dp&quot;&gt;
  
          &lt;com.google.android.material.textfield.TextInputEditText
              android:id=&quot;@+id/textInputLayoutEdit&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:minHeight=&quot;200dp&quot;
              android:gravity=&quot;top&quot; /&gt;
  &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  </code></pre>
  <p>This TextInputLayout's height is dynamic, as in, the height will grow when more text is being written. So in a case where the height is becoming bigger than the screen, and scrolling would be needed in order to see the first line of the TextInputLayout, there is an issue with writing focusing. When writing all the way at top, the screen focus will go all the way to the bottom while the cursor is still at top. This prevents me from seeing what is being written at top because the screen is being scrolled to the bottom of the TextInputLayout. And sometimes the focus goes back to the top, almost like a glitchy flickering.</p>
  <p>Writing at bottom works as normal, since bottom screen focus is always prioritized. Writing at top when the TextInputLayout's height has not exceeded the screen yet, also works fine since there is no need to scroll.</p>
  <p>Is there a property I need to set in TextInputLayout, in order to make the screen focus where I am writing?</p>
  <p><strong>UPDATE 1:</strong></p>
  <p>It seems to be related to the keyboard always being right below the bottom of the TextInputLayout. So when typing, the keyboard will always want to be at bottom, and writing at top will just pull the screen focus all the way to bottom where the keyboard is being placed.</p>
  <p>A way to prevent the keyboard from being fixed under the TextInputLayout is to set the following in the Activity (AndroidManifest.xml):</p>
  <pre><code>android:windowSoftInputMode=&quot;adjustPan&quot;
  </code></pre>
  <p>This will prevent the need for the keyboard to force up the layout upwards so that it can fit in. This will solve my problem of being &quot;pulled down all the way down&quot;, when writing, even though I am writing all the way at top and the bottom is not visible due to the big height. But... fixing the keyboard like this will prevent me from seeing what I am writing at bottom, since the keyboard is blocking what I am writing. So ideally, I still want the keyboard to automatically make space at bottom for the keyboard, and at the same time I don't want the keyboard to pull the screen focus all the way down.</p>
  <p><strong>UPDATE 2 (SOLVED):</strong></p>
  <p>I managed to solve this and the solution can be seen in my answer below.</p>
  <p><strong>TL;DR</strong>, add the following in TextInputEditText:</p>
  <pre><code>app:textInputLayoutFocusedRectEnabled=&quot;false&quot;
  </code></pre>