edit:
I need to use the keyboard, but it hides my EditText
, I need it to scroll so the keyboard is not hiding it.
I am using a Samsun
I solved the problem by installing another soft keyboard, via the google play store.
It was Petey's comments that made me explore this solution.
The IME you used has it's own "floating" layout, can you try your code with built-in IMEs like Google Keyboard or set your IME to a normal full-width layout?
So I figured, no amount of playing with the view layout was going to affect a soft keyboard that has an independent layout.
I used this link https://code.google.com/p/softkeyboard/wiki/HowTo
It even works with Android Manifest:
android:windowSoftInputMode="stateHidden"
I then use imeoptions
to control the flow of the editor cursor within the view.
edit update
I just tried the app on a no-brand android tablet, which comes with comes with a generic android keyboard and it works, without having to change a thing. It seems the Samsung default keyboard is painful.
I have tried this code and resolve my issue.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Try to call InputMethodManager.hideSoftInputFromWindow()
during your fragment's onActivityCreated()
function mentioned in this SO answer?
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppUtil.hideKeyboard(getActivity(), getView());
}
where hideKeyboard()
looks like this
public static void hideKeyboard(Activity activity, View viewToHide) {
InputMethodManager imm = (InputMethodManager) activity
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(viewToHide.getWindowToken(), 0);
}