virtual keyboard hiding edit text, setting from fragment

a 夏天 提交于 2019-12-13 03:43:57

问题


Well problem is similar that Keyboard is hiding my edit text but is there some way to handle the virtual keyboard setting from my layout xml file or fragment class rather that from android manifest file.

For example: we use android:windowSoftInputMode="adjustPan" from manifest file. What can we do if we want to change it from my layout xml file or from my fragment java class file. This requirement is simply because I need different behavior on different screens. an d above code adjust complete activity.

Note: In my app each screen is divided into two part with one part changing and is fragment, and other part menu. I don't want menu part to be disturbed only fragment portion can shift when keyboard appears. I have already used getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); from my fragment class. And result is same i.e. for complete activity.

Please help. Thanks in advance.


回答1:


May be this is useful for you..

http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions


set in edittext in layout.xml file

android:imeOptions="flagNoExtractUi"



回答2:


What I can suggest you is to use "adjustPan" as it is, how you are using it, so that Your entire layout shift upwards, and editText comes to focus. And put your menu portion into scrollview, so that user can scroll that also, when he wants any info from your menu part. This Will overcome both your problem. I know this not the solution you wanted and this is a workaround. but hope this helps.



来源:https://stackoverflow.com/questions/9987044/virtual-keyboard-hiding-edit-text-setting-from-fragment

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