Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.11 KB

README_KeyboardLayout.md

File metadata and controls

38 lines (30 loc) · 1.11 KB

KeyboardLayout

监听输入法键盘的弹起与隐藏,可实现输入法和工具栏无缝切换

01

  • 示例

在布局中任意添加:

...

<cn.forward.androids.views.KeyboardLayout
        android:id="@+id/keyboard_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
...
mKeyboardLayout = (KeyboardLayout) findViewById(R.id.keyboard_layout);
mKeyboardLayout.setKeyboardListener(new KeyboardLayout.KeyboardLayoutListener() {
        @Override
        public void onKeyboardStateChanged(boolean isActive, int keyboardHeight) {
            if (isActive) { // 输入法打开
                // ...
            } else{
                // ...
            }
        }
    });

点击查看示例代码

  • 更多

《Android监听输入法并获取高度——输入法与页面布局无缝切换》