moving edit text along with soft keyboard android

有些话、适合烂在心里 提交于 2019-12-10 17:49:48

问题


I am having an comment edit text in my application. The edit text is aligned at the bottom of the screen. when edit text is focused i want to move edit text alone with soft keyboard without changing other views in layout similar to comment edit box in facebook. I tried adjustpan in manifest but it moves all views up with soft keyboard. adjustresize in manifest hides some view.please provide suggestions.


回答1:


Try like this inside your Android manifest file..

<activity name="YourActivity"
    android:windowSoftInputMode="stateVisible|adjustResize">
</activity>

or

<activity name="YourActivity"
    android:windowSoftInputMode="stateVisible|adjustPan">
</activity>

Please also read this for ref/Clarity




回答2:


Add

android:windowSoftInputMode="adjustPan"

in your AndroidManifest file (in activity property)




回答3:


dialog.getWindow(). setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

Its also working with out manifest file entry



来源:https://stackoverflow.com/questions/17160818/moving-edit-text-along-with-soft-keyboard-android

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