Get the height of virtual keyboard in Android

前端 未结 6 1432
有刺的猬
有刺的猬 2020-12-01 14:31

How can I get the height of virtual keyboard in Android? Is it possible?

I try to get it from the main window, but it gives me full height of the application. But I

6条回答
  •  攒了一身酷
    2020-12-01 15:17

    Try this

    KeyboardView keyboardView = new KeyboardView(getApplicationContext(), null);
    int height = (keyboardView.getKeyboard()).getHeight();
    Toast.makeText(getApplicationContext(), height+"", Toast.LENGTH_LONG).show();
    

提交回复
热议问题