Difference between adjustResize and adjustPan in android? Difference between adjustResize and adjustPan in android? android android

Difference between adjustResize and adjustPan in android?


From the Android Developer Site link

"adjustResize"

The activity's main window is always resized to make room for the softkeyboard on screen.

"adjustPan"

The activity's main window is not resized to make room for the softkeyboard. Rather, the contents of the window are automatically pannedso that the current focus is never obscured by the keyboard and userscan always see what they are typing. This is generally less desirablethan resizing, because the user may need to close the soft keyboard toget at and interact with obscured parts of the window.

according to your comment, use following in your activity manifest

<activity android:windowSoftInputMode="adjustResize"> </activity>


adjustResize = resize the page content

adjustPan = move page content without resizing page content


I was also a bit confused between adjustResize and adjustPan when I was a beginner. The definitions given above are correct.
AdjustResize : Main activity's content is resized to make room for soft input i.e keyboard
AdjustPan : Instead of resizing overall contents of the window, it only pans the content so that the user can always see what is he typing
AdjustNothing : As the name suggests nothing is resized or panned. Keyboard is opened as it is irrespective of whether it is hiding the contents or not.

I have a created a example for better understanding
Below is my xml file:

<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">    <EditText        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:gravity="center"        android:hint="Type Here"        app:layout_constraintTop_toBottomOf="@id/button1"/>    <Button        android:id="@+id/button1"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:text="Button1"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toStartOf="@id/button2"        app:layout_constraintStart_toStartOf="parent"        android:layout_marginBottom="@dimen/margin70dp"/>    <Button        android:id="@+id/button2"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:text="Button2"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintStart_toEndOf="@id/button1"        app:layout_constraintEnd_toStartOf="@id/button3"        android:layout_marginBottom="@dimen/margin70dp"/>    <Button        android:id="@+id/button3"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:text="Button3"        app:layout_constraintRight_toRightOf="parent"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toEndOf="@id/button2"        android:layout_marginBottom="@dimen/margin70dp"/></android.support.constraint.ConstraintLayout>

Here is the design view of the xml
original view

AdjustResize Example below:
adjustResize example

AdjustPan Example below:
adjustPan example

AdjustNothing Example below:
adjustNothing example