popwindow中有EditText,弹出软件盘和软件盘弹出后界面的兼容问题

遇到的问题

  • 软件盘无法弹出
    答:设置popwindow的isFocusable为true,popwindow应获取焦点。但是设置为true之后点击其他可以弹出popwindow的按钮,不会直接弹出其他popwindow,而是先取消显示当前popwindow,再次点击才会显示其他popwindow。
filterPopWindow.isFocusable = true
  • 软件盘弹出后,有的手机popwindow上移,有些手机popwindow位置高度不变,内容也不上移,导致popwindow部分内容被挡住了。
    答:监听软件盘的弹出和关闭,对应的修改popwindow和里面内容布局的高度。
   //软键盘弹出和收回的监听
        val softKeyboardStateHelper1 =
            SoftKeyboardStateHelper(tvFilter)
        softKeyboardStateHelper1.addSoftKeyboardStateListener(object : SoftKeyboardStateHelper.SoftKeyboardStateListener {
           override fun onSoftKeyboardOpened(keyboardHeightInPx: Int) {
           //更新popwindow的高宽
               filterPopWindow.update(llFunctionButton, ViewGroup.LayoutParams.MATCH_PARENT,llModuleLoading.height - llFunction.height+if (isFromNavigation) ScreenUtil.dp2px(50f) else 0)
               val param= filterPopWindow.llContent.layoutParams
               val llContentHight=if (filterPopWindow.llContent.height>filterPopWindow.height) filterPopWindow.height-ScreenUtil.dp2px(20f) else filterPopWindow.llContent.height
               param.height=llContentHight
               filterPopWindow.llContent.layoutParams=param
               val param2= filterPopWindow.maxHeightF.layoutParams
               param2.height=llContentHight-filterPopWindow.clBottomFuction.height
               filterPopWindow.maxHeightF.layoutParams=param2
               val param3= filterPopWindow.llContainer.layoutParams
               param3.height=llContentHight-filterPopWindow.clBottomFuction.height
               filterPopWindow.llContainer.layoutParams=param3
               val param4= filterPopWindow.nestSw.layoutParams
               param4.height=llContentHight-filterPopWindow.clBottomFuction.height
               filterPopWindow.nestSw.layoutParams=param4

            }

          override  fun onSoftKeyboardClosed() {
              filterPopWindow.update(llFunctionButton, ViewGroup.LayoutParams.MATCH_PARENT,llModuleLoading.height - llFunction.height+if (isFromNavigation) ScreenUtil.dp2px(50f) else 0)
              val param= filterPopWindow.llContent.layoutParams
              param.height=ViewGroup.LayoutParams.WRAP_CONTENT
              filterPopWindow.llContent.layoutParams=param
              val param2= filterPopWindow.maxHeightF.layoutParams
              param2.height=ViewGroup.LayoutParams.WRAP_CONTENT
              filterPopWindow.maxHeightF.layoutParams=param2
              val param3= filterPopWindow.llContainer.layoutParams
              param3.height=ViewGroup.LayoutParams.WRAP_CONTENT
              filterPopWindow.llContainer.layoutParams=param3
              val param4= filterPopWindow.nestSw.layoutParams
              param4.height=ViewGroup.LayoutParams.WRAP_CONTENT
              filterPopWindow.nestSw.layoutParams=param4

            }
        })
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值