Jacksgong / JKeyboardPanelSwitch

For resolve the layout conflict when keybord & panel are switching (Android键盘面板冲突 布局闪动处理方案)
Apache License 2.0
4.18k stars 684 forks source link

多个面板切换问题 #22

Closed zhangjinhuang closed 8 years ago

zhangjinhuang commented 8 years ago

当我实现多面板切换时,通过增加KPSwitchPanelLinearLayout来实现的话,此时点击输入框时新增的KPSwitchPanelLinearLayout会被弹出的键盘顶到键盘上面而不是被键盘遮住,而点击原先那一个的话,却又正常,并且我把第一个相差的代码全部注释只留自己增加的那一个时,仍然会跑到键盘上面去,我想问一下这是什么原因?

Jacksgong commented 8 years ago

是这样的,你用最新的版本,可以留意下 最新版本: https://github.com/Jacksgong/JKeyboardPanelSwitch/releases/tag/v1.4.5

其次,其实很多情况就是有多个面板,一个表情面板,一个工具面板,做法就是将两个面板的内容放到一个布局: KPSwitchPanelFramelayout 里面,在需要显示那个的时候,再显示哪个,例如这样子:

<?xml version="1.0" encoding="utf-8"?>
<!-- 可选用 KPSwitchRootLinearLayout、KPSwitchRootRelativeLayout、KPSwitchRootFrameLayout -->
<cn.dreamtobe.kpswitch.widget.KPSwitchRootLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- 布局内容 -->
    ...

    <cn.dreamtobe.kpswitch.widget.KPSwitchPanelFrameLayout
        android:id="@+id/panel_root"
        android:layout_width="fill_parent"
        android:layout_height="@dimen/panel_height"
        android:visibility="gone">
        <!-- 面板内容 -->
        <LinearLayout
            android:id="@+id/emoji_panel"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            < !-- 表情面板内容 -->
        </LinearLayout>    

        <LinearLayout
            android:id="@+id/tool_panel"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            < !-- 工具面板内容 -->
        </LinearLayout>        
    </cn.dreamtobe.kpswitch.widget.KPSwitchPanelLinearLayout>

</cn.dreamtobe.kpswitch.widget.KPSwitchRootLinearLayout>