After updating the target version of the Xamarin.Android app to Android 9 and the mobile device to Android 9, I've seen a weird behaviour on an EditText in a DialogFragment. When the dialog opens, the EditText requests focus allowing the user to type into it. But since I've updated the version to 9, the EditText seems to hide the value which was in the EditText field until I press a key on the keyboard.
I have added the below lines to my AndroidManifest file but without a resolution:
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustPan"
I have also tried giving the text size a lower pixel size and increased the height of the EditText just to triple check. But this did nothing.
Now if I create an emulator with an OS of 7.1 and build the app to target 7.1, it works as expected without hiding the value until a keypress.
Adding Layout xml file for reference:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_gravity="right|center"
android:id="@+id/delete"
android:src="@drawable/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:textSize="26dp"
android:maxLength="13"
android:inputType="number"
android:layout_width="210dp"
android:layout_height="wrap_content"
android:id="@+id/bEdit"
android:layout_column="1"
android:hint="B" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bError"
android:visibility="gone">
<TextView
android:textStyle="bold"
android:textColor="@color/munster_red"
android:text="Error: Invalid B"
android:textSize="17dp"
android:layout_marginLeft="10px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1" />
</LinearLayout>
<TableLayout
android:gravity="center"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp">
<TableRow
android:gravity="center"
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unit: "
android:layout_gravity="right|center" />
<TextView
android:text="1"
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/unitNumber" />
</TableRow>
<TableRow
android:gravity="center"
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkedTextView1"
android:text="Tag: "
android:layout_gravity="right|center" />
<EditText
android:textSize="28dp"
android:inputType="number"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="@+id/tagEdit"
android:maxLength="5" />
</TableRow>
<TableRow
android:gravity="center"
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkedTextView1"
android:text="Y:"
android:layout_gravity="right|center" />
<EditText
android:focusable="true"
android:focusableInTouchMode="true"
android:textSize="30dp"
android:inputType="numberDecimal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:maxLength="4"
android:id="@+id/yEdit" />
</TableRow>
<TableRow
android:visibility="gone"
android:id="@+id/yieldError"
android:gravity="center"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/yMessage"
android:textStyle="bold"
android:textColor="@color/red"
android:text="Warning: Y out of Range"
android:textSize="15dp"
android:layout_marginLeft="10px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1" />
<LinearLayout
android:layout_gravity="left|center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:text="Cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cancel" />
<Button
android:layout_margin="2dp"
android:padding="12dp"
android:background="@drawable/blue_button"
android:text="Missed Y"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mYield"
android:textColor="@color/white"
android:textStyle="bold" />
<Button
android:layout_margin="2dp"
android:padding="12dp"
android:background="@drawable/green_button_inactive"
android:text="Save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/save"
android:textColor="@color/green"
android:textStyle="bold" />
</LinearLayout>
</TableLayout>
Has anyone had something similar?
--- EDIT
I have also copy and pasted the EditText which is causing the issue and pasted it under the issued one. The problem went away and acted as usual. It's very strange and only started happening after the upgrade, no changes were made to the layout previously or the code.