简体   繁体   English

软键盘按钮

[英]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 让我知道是否有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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