My Android fragment is using the support GridLayout to display equally-spaced views (first image). In my manifest I'm changing how the soft keyboard displays so it resizes the GridLayout when I tap on the EditText and the keyboard is displayed (second image):
android:windowSoftInputMode="adjustResize|stateHidden"
When the soft keyboard is hidden, the GridLayout does not reset back to its initial size (last image).
Any idea on how to get the GridLayout to go back to its original configuration in the first screenshot? I know if I remove the android:windowSoftInputMode
from the manifest the problem goes away, but that is not something I can change in another app from which this demo is created.
Here's the fragment's layout file:
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
grid:columnCount="2"
grid:rowCount="3"
grid:orientation="horizontal">
<EditText
android:layout_width="100sp"
android:layout_height="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"
android:text="B"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"
android:text="C"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"
android:text="D"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"
android:text="E"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="80sp"
grid:layout_gravity="center"
grid:layout_columnWeight="1"
grid:layout_rowWeight="1"
android:text="F"/>
</android.support.v7.widget.GridLayout>