Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjust scrollview when keyboard is up

I have an activity with a form in it. Because the form is quite long, I've used a scrollview.

The problem is that the scrollview doesn't change when the keyboard is up. The keyboard overlaps the last part of the scrollview.

How can I make sure that the keyboard is below the scrollview and the scrollview is adjusted to fit the space above it?

In the meanwhile, is there a way to make sure the buttons ‘previous’ and ‘next’ are in the keyboard as well?

like image 299
dumazy Avatar asked Sep 14 '12 10:09

dumazy


People also ask

How do I scroll up when keyboard appears in IOS?

Handling the Keyboard Appearing Notification There are two things to do in keyboardWasShown to scroll the text view. First, set the text view's content inset so the bottom edge is the keyboard's height. Second, set the scroll indicator insets to the text view's content inset.

What is the difference between ScrollView and horizontal ScrollView?

ScrollView and HorizontalScrollView has same attributes, the only difference is scrollView scroll the child items in vertical direction while horizontal scroll view scroll the child items in horizontal direction.

What is the difference between ScrollView and ListView?

ScrollView is used to put different or same child views or layouts and the all can be scrolled. ListView is used to put same child view or layout as multiple items. All these items are also scrollable. Simply ScrollView is for both homogeneous and heterogeneous collection.


2 Answers

In the application's manifest file, add the following to the desired <activity /> --

 android:windowSoftInputMode="stateAlwaysHidden|adjustResize|adjustPan"
like image 156
Prashant Mishra Avatar answered Sep 18 '22 17:09

Prashant Mishra


You need to add android:windowSoftInputMode="adjustResize" in the AndroidManifest.xml file.

like image 33
Bucks Avatar answered Sep 18 '22 17:09

Bucks