Android windowSoftInputMode=“adjustPan” scroll some more

≯℡__Kan透↙ 提交于 2019-11-29 01:47:16

问题


Consider the following example for a view:

<LinearLayout>
    <EditText />
    <Button />
</LinearLayout>

And in in the manifest file:

android:windowSoftInputMode="adjustPan"

onfocus edittext, the soft keyboard covers a button like so:

but I'd like it like this:

How to scroll view a little more so that the button is visible?


回答1:


I just found this post and saw it was unanswered. For the sake of helping others who may come use this in the manifest for activity

android:windowSoftInputMode="stateUnchanged|adjustResize"

try just one and see if that suits your needs.

Good luck




回答2:


Can you add an empty RelativeLayout below the buttons. set its android:layout_height="50dp" or any value that satisfy your need. And use a ScrollView, notice that ScrollView can only have 1 child layout.

<ScrollView >
  <LinearLayout>
    <EditText />
    <Button />
    <RelativeLayout 
      android:layout_height="50dp"
      android:layout_width="match_parent" />
  </LinearLayout>
</ScrollView>


来源:https://stackoverflow.com/questions/17423459/android-windowsoftinputmode-adjustpan-scroll-some-more

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