Prevent keyboard from blocking the input box for WiFi configuration page.

Bug: 223980567
Test: manual
Change-Id: I2b95b065394e2395396ff71b00bd949ac824dac3
This commit is contained in:
Binyi Wu
2022-05-23 17:40:21 +08:00
parent 97a3f54878
commit 26e5e919c8
3 changed files with 12 additions and 1 deletions

View File

@@ -18,7 +18,8 @@
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -24,6 +24,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
@@ -82,6 +83,10 @@ public class AddNetworkFragment extends InstrumentedFragment implements WifiConf
ssidScannerButton.setOnClickListener(this);
mUIController = new WifiConfigController2(this, rootView, null, getMode());
// Resize the layout when keyboard opens.
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
return rootView;
}

View File

@@ -31,6 +31,7 @@ import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import androidx.annotation.VisibleForTesting;
@@ -124,6 +125,10 @@ public class ConfigureWifiEntryFragment extends InstrumentedFragment implements
actionBar.setDisplayShowHomeEnabled(false);
}
// Resize the layout when keyboard opens.
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
return rootView;
}