naivd
naivd

Reputation: 65

How to prevent soft keyboard cover my views

In the layout file of one of my activities I've got 2 inputs at the top and at the bottom and a next button.

The problem is, when keyboard shows, it covers the button. How can I bring the views above keyboard?

Upvotes: 3

Views: 2504

Answers (2)

Kush
Kush

Reputation: 1092

Just put in manifest.. Use "adjustResize"

It makes main window always resized to make room for the soft keyboard on screen.

<application
......
>
<activity
           .............................
            android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />

 </application>

Upvotes: 0

user4774371
user4774371

Reputation:

Check this blog post On-screen Input Methods

You can use android:windowSoftInputMode attribute to specify what should happen whether the layout is resized or whether it scrolls.

In your manifest file

<activity name=".YourActivity"
        android:windowSoftInputMode="stateVisible|adjustResize">
        ...
</activity>

Related questions:

Move layouts up when soft keyboard is shown?

Push up content when clicking in edit text

Android: How do I prevent the soft keyboard from pushing my view up?

How to move the layout up when the soft keyboard is shown android

How to check visibility of software keyboard in Android?

Upvotes: 4

Related Questions