Android EditText, soft keyboard show/hide event? Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Android EditText, soft keyboard show/hide event? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

Is it possible to catch the event that Soft Keyboard was shown or hidden for EditText?


Hi I’d used following workaround:

As far as my content view is a subclass of LinearLayout (could be any other view or view group), I’d overridden onMeasure method lilke following:

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final int proposedheight = MeasureSpec.getSize(heightMeasureSpec);
    final int actualHeight = getHeight();

    if (actualHeight > proposedheight){
        // Keyboard is shown
    } else {
        // Keyboard is hidden

    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

This workaround helped me to hide some controls when keyboard is showing and bring back otherwise.

Hope this would be useful.

We are here to answer your question about Android EditText, soft keyboard show/hide event? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji