1

I have GridView android:layout_height="match_parent" with Editboxes, in LinearLayout with fix android:layout_height.

When I touch editbox, appears keyboard.

How to change android:layout_height in LinearLayout when keyboard appears and when disappears?

Vikalp Patel
  • 10,082
  • 6
  • 55
  • 92
Ivan
  • 181
  • 1
  • 2
  • 11

1 Answers1

0

Try the link below hope it may help you

http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

http://davidwparker.com/2011/08/30/android-how-to-float-a-row-above-keyboard/

private OnSoftKeyboardListener onSoftKeyboardListener;

@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
    if (onSoftKeyboardListener != null) {
        final int newSpec = MeasureSpec.getSize(heightMeasureSpec); 
        final int oldSpec = getMeasuredHeight();
        if (oldSpec > newSpec){
            onSoftKeyboardListener.onShown();
        } else {
            onSoftKeyboardListener.onHidden();
        }
    }
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

public final void setOnSoftKeyboardListener(final OnSoftKeyboardListener listener) {
    this.onSoftKeyboardListener = listener;
}

public interface OnSoftKeyboardListener {
    public void onShown();
    public void onHidden();
}
Janmejoy
  • 2,695
  • 1
  • 16
  • 38
  • More detailed answer is here http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android/4737265#4737265 – Ivan Jan 21 '13 at 16:01