0
當我們在Javascript中隱藏/顯示鍵盤時,哪個事件觸發?我如何訂閱?我需要在鍵盤完全隱藏後顯示我的區塊。鍵盤在android中隱藏事件
當我們在Javascript中隱藏/顯示鍵盤時,哪個事件觸發?我如何訂閱?我需要在鍵盤完全隱藏後顯示我的區塊。鍵盤在android中隱藏事件
這是這件事情,我發現here:
@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);
}
或者你可以使用從here方法:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks whether a hardware keyboard is available
if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
Toast.makeText(this, "keyboard visible", Toast.LENGTH_SHORT).show();
} else if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
Toast.makeText(this, "keyboard hidden", Toast.LENGTH_SHORT).show();
}
}
這是JavaScript的? – falko
它是java,當事件在那裏被捕獲時,那麼可以執行javascript塊。 – g00dy