简体   繁体   中英

Soft keyboard button

My question is very simple. I just need to know what event this close keyboard button produces. I want to listen for the event and execute a simple method when the event is captured... I have searched many questions but all the solutions I tried was directed at other key events.

键盘关闭按钮

I have researched this a little before and kept crossing conversations where people were saying that there isn't such an event to capture.

Not sure what you are wanting to capture this event for but, here is a little work around that helped me:

@Override
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);
}

Source . Let me know if that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM