Why doesn't android:windowSoftInputMode=“stateVisible|adjustResize” adjust the screen when soft keyboard is shown?

后端 未结 5 1852
情书的邮戳
情书的邮戳 2021-01-03 03:02

I can\'t seem to make the android:windowSoftInputMode=\"stateVisible|adjustResize\" option work. When the soft keyboard shows, the scroll view doesn\'t automatically scroll

5条回答
  •  孤独总比滥情好
    2021-01-03 03:56

    You could automatically scroll to the bottom of your activity by yourself, by overriding the onConfigurationChanged() callback in you Activity :

    scrollView.post(new Runnable() {            
        @Override
        public void run() {
               scrollView.fullScroll(View.FOCUS_DOWN);              
        }
    });
    

    This means you also have to tell your activity you want the callback to be called when the activity changes its layout by using the configChanges attribute in the activity declaration in your AndroidManifest file :

    
        ... >
    
    

    I hope this can help you.

提交回复
热议问题