5
votes

I have a form that is displayed inside http://ionicframework.com/docs/api/service/$ionicPopup/. The issue is that when cursor is placed inside the final input (text area), the keyboard shows but the input doesn't scroll back into view and is obscured by the keyboard. The user has to scroll down.

I am using an android device.

The documentation says

Ionic will attempt to prevent the keyboard from obscuring inputs and focusable elements when it appears by scrolling them into view. In order for this to work, any focusable elements must be within a Scroll View or a directive such as Content that has a Scroll View.

If I wrapped the form with ion-content tag, the input box does scroll back into view but using messes up with my layout and am looking for another solution.

Update: How the manifest lookslike

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="myAwesomeApp" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
    <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
        <intent-filter android:label="@string/launcher_name">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="me.apla.cordova.AppPreferencesActivity" />
    <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden">
        <intent-filter>
            <action android:name="com.google.zxing.client.android.SCAN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity android:label="@string/share_name" android:name="com.google.zxing.client.android.encode.EncodeActivity">
        <intent-filter>
            <action android:name="com.phonegap.plugins.barcodescanner.ENCODE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity android:label="@string/share_name" android:name="com.google.zxing.client.android.HelpActivity">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="false" />

3

3 Answers

0
votes

Add this into your Activity in AndroidMenifest

 android:configChanges="keyboardHidden|orientation|screenSize"
0
votes

If you are using cordova keyboard you can Use cordova.plugins.Keyboard.disableScroll(false); when the popup open and use cordova.plugins.Keyboard.disableScroll(true); when it closes. this way the layout can handle overlapping keyboard in case of using popups.

0
votes

You have to set android:windowSoftInputMode="adjustResize" in the manifest to the Application or to the Activity.

And check whether you set something like, getWindow().setSoftInputMode(...) in your Activity. If so, remove those lines.