Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - A blank space remains when the keyboard disappears

I am having an issue with the keyboard. When it disappears, the space it occupied remains blank and the rest of the layout does not adjust

normal screen:

enter image description here

with keyboard:

enter image description here

keyboard dismissed:

enter image description here

I have never seen this before, so I am not even sure where to start looking. This happens on 4.2.2 as well as 5.1

The other piece of important information is that this is a custom LinearLayout that holds all of the content. Maybe it has something to do with that. I can upload any code if necessary.

This is the main layout file shell.

<com.edgetechlabs.app_v2.MasterLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Menu (Drawer)-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:visibility="visible"
    android:layout_height="match_parent"
    android:orientation="vertical" >
     <ScrollView
        android:id="@+id/activity_main_menu_listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/drawer_background"
        android:cacheColorHint="#00000000" >
     </ScrollView>
</LinearLayout>
<!-- Fragment Holder -->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <!-- This is where fragment will show up -->
    <FrameLayout
        android:id="@+id/fragment_master"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>
</LinearLayout>

This is my manifest file

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MasterActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
like image 915
The4thIceman Avatar asked May 07 '15 05:05

The4thIceman


Video Answer


1 Answers

I added

android:windowSoftInputMode="adjustPan"

to my manifest within the activity tag, and now it works. I have never had to do that before, I guess my custom layout was messing with the keyboard somehow.

Thanks to @eee comment which pointed me in the right direction

like image 184
The4thIceman Avatar answered Sep 24 '22 02:09

The4thIceman