I have tried various solutions. I have tried adding android:windowSoftInputMode="adjustResize"
to my manifest along with adjustPan
. I am not sure why I am having such a hard time with this problem since it seems like such an easy fix and I have come across multiple posts asking a similar question but none of the solutions work for me.
Below is my XML layout file
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:windowSoftInputMode="adjustResize">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient"
android:orientation="vertical"
android:padding="30dp">
<TextView
android:id="@+id/truckForm_txv_appTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:fontFamily="@font/rubik_light"
android:paddingTop="8dp"
android:text="Truck Owner Form"
android:textColor="@color/colorPrimaryText"
android:textSize="35sp"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="@color/colorPrimaryText" />
<LinearLayout
android:id="@+id/truckForm_LL_firstAndLast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:orientation="horizontal"
android:weightSum="2">
<EditText
android:id="@+id/truckForm_ed_first"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimaryText"
android:fontFamily="@font/rubik_light"
android:hint="@string/hint_first_name"
android:inputType="textPersonName"
android:nextFocusForward="@id/signUp_ed_last"
android:textColor="@color/colorPrimaryText"
android:textColorHint="@color/colorPrimaryText" />
<EditText
android:id="@+id/truckForm_ed_last"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/colorPrimaryText"
android:fontFamily="@font/rubik_light"
android:hint="@string/hint_last_name"
android:inputType="textPersonName"
android:textColor="@color/colorPrimaryText"
android:textColorHint="@color/colorPrimaryText" />
</LinearLayout>
<EditText
android:id="@+id/truckForm_ed_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:backgroundTint="@color/colorPrimaryText"
android:ems="10"
android:fontFamily="@font/rubik_light"
android:hint="@string/hint_email"
android:inputType="textEmailAddress"
android:textColor="@color/colorPrimaryText"
android:textColorHint="@color/colorPrimaryText" />
<EditText
android:id="@+id/truckForm_ed_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:backgroundTint="@color/colorPrimaryText"
android:ems="10"
android:fontFamily="@font/rubik_light"
android:hint="Truck Title"
android:textColor="@color/colorPrimaryText"
android:textColorHint="@color/colorPrimaryText" />
<EditText
android:id="@+id/truckForm_ed_phoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:backgroundTint="@color/colorPrimaryText"
android:ems="10"
android:fontFamily="@font/rubik_light"
android:hint="Truck Owner's Phone Number"
android:inputType="phone"
android:textColor="@color/colorPrimaryText"
android:textColorHint="@color/colorPrimaryText" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<Spinner
android:id="@+id/truckForm_spin_genres"
style="@style/Widget.AppCompat.Spinner.Underlined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorPrimaryText"
android:ems="10"
android:fontFamily="@font/rubik_light"
android:gravity="center" />
<EditText
android:id="@+id/truckForm_ed_genre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:ems="10"
android:fontFamily="@font/rubik_light" />
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/truckForm_btn_signUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:backgroundTint="@color/colorSecondary"
android:fontFamily="@font/rubik_light"
android:padding="12dp"
android:text="Sign Up"
android:textSize="15sp"
android:textStyle="bold" />
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
Any information would be greatly appreciated!
FOUND A SOLUTION THAT SOLVED MY PROBLEM:
Soon after I posted this I came across this post https://stackoverflow.com/a/35914507/12257857 which helped me find the solution to my problem.
My solution was adding:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); in my onCreate() of the activity with the XML. Thank you guys!