Android: ScrollView not scrolling with keyboard out

后端 未结 11 1560
别跟我提以往
别跟我提以往 2020-12-04 15:23

I\'ve got a layout with some views, from which one is an EditText. The layout easily fits on one page, BUT, when the soft keyboard is out, the layout doesn\'t scroll. Here\'

相关标签:
11条回答
  • 2020-12-04 16:04

    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.

    0 讨论(0)
  • 2020-12-04 16:05

    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.

    0 讨论(0)
  • 2020-12-04 16:11

    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.

    0 讨论(0)
  • 2020-12-04 16:12

    In my case, what solved this was setting a missing constraint in the Bottom. My ScrollView had top, right, and left constraints, but no bottom one. After restricting it from all sides, it started to overlap the above textview, which prompted me to try putting the height to 0dp, and that seemed to solve the problem.

    0 讨论(0)
  • 2020-12-04 16:14
    <activity 
        android:windowSoftInputMode="adjustResize"
    >
    

    try this In android manifest ..

    0 讨论(0)
  • 2020-12-04 16:15

    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.

    0 讨论(0)
提交回复
热议问题