user2442638
user2442638

Reputation:

softInputMode in fragments

I have a NavigationDawer with some fragments which contain EditTexts. When I 'open' the fragment, the layout is fine (ie. not squashed) but when I bring the keyboard up, the layout becomes squashed.

I searched around and added this to the manifest:

<activity
    android:name=".Navigation_Drawer"
    android:label="@string/app_name"
    android:windowSoftInputMode="adjustResize" > // This being the important part
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Because the Navigation Drawer is the only activity that contains/starts these fragments, the fragment's softInputMode should be controlled by the activity, but this code does not make any difference

Thank you

Upvotes: 4

Views: 1599

Answers (2)

Renjith Krishnan
Renjith Krishnan

Reputation: 2616

Remove the code:

android:windowSoftInputMode="adjustResize"

from manifest file.

Upvotes: 3

athor
athor

Reputation: 6928

Have you tried setting the windowSoftInputMode to adjustPan?

adjustResize will resize the activity to allow room for the keyboard, which is the behaviour you are experiencing. If you set the windowSoftInputMode to adjustPan, the activity will be be 'panned', or moved upwards to make room for the keyboard.

android:windowSoftInputMode="adjustPan"

Upvotes: 2

Related Questions