Skip to content

Instantly share code, notes, and snippets.

@gitzxon
gitzxon / java
Last active February 18, 2019 10:05
find the soft keyboard height, and scroll the target view when it is hidden by the soft keyboard.
public class KeyboardUtil {
public static void hide(View v) {
InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null && imm.isActive()) {
imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
}
}
public interface SoftKeyboardCallback {