Android: ScrollView not scrolling with keyboard out

家住魔仙堡 提交于 2019-11-27 18:07:36
Ciprian

I had the same problem and I checked my activity in the manifest, and the reason why it wasn't working is because I didn't use this property:

android:windowSoftInputMode="adjustResize"

Now it works great and no need to do additional anchors.

Okay, apparently the ScrollView's android:layout_height mustn't be set to wrap_content. I set it to match_parent and set the android:layout_above to the button on the bottom of the page.

Don't ask me why, but this fixed the issue.

In my case, nothing of the above worked.

I had item name="android:windowTranslucentStatus">true</item> in my theme. And it was fixed by setting android:fitsSystemWindows="true" in the parent layout where is my scrollview.

Rajesh Hegde

Add android:windowSoftInputMode="stateHidden|adjustResize" to your tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.

My problem was with a HorizontalScrollView. In my case I had to set HorizontalScrollView to:

android:layout_width="match_parent"
android:layout_height="match_parent"

And remove:

 android:layout_above="@+id/closeButton"
 android:layout_below="@+id/logo"

In the AndroidManifest.xml the activity is set to:

android:windowSoftInputMode=""

I hope this helps anyone comming across this weird bug.

Try to set ScrollView as your parent layout. It works like charm for me!

In my case any of the solution above does not work until I REMOVE

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

in my activity, I use that code to get a full screen display. Maybe for certain cases, try to remove any setup of full screen to make any of the above solution works.

<activity 
    android:windowSoftInputMode="adjustResize"
>

try this In android manifest ..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!