Problems With Edittext And Soft Keyboard In A Fragment
I'm currently building an android application that enables users to take pictures and write details of it. The application uses Sherlock libraries. I've implemented a SherlockFragm
Solution 1:
this worked for me in a scenario where I was using multiple layouts and a viewstub to create a messaging screen. Place this in onCreate() Hope this helps.
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Solution 2:
All fragments of one Activity
have the same behaviour as their parent Activity
, but if you need different keyboard behaviour for different Fragments
, you could dynamically change this property from your Fragment
code like this:
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.softInputMode.SOFT_INPUT_ADJUST_PAN);
Hope this helps!
Solution 3:
This can be used in Fragment Class to move the Edit text up and Scroll till end.
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Solution 4:
android:windowSoftInputMode="adjustPan"
All the Fragments related to that activity behave same, if you want to change the behaviour of perticular fragment than use the following one
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Solution 5:
try this getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Post a Comment for "Problems With Edittext And Soft Keyboard In A Fragment"