From 92c34cbad5cbfd6390f52e2cf6b15614a1be7cc3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 10 Mar 2022 15:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/widget/KeyboardToolPop.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt index 2088a8eec..103e8d259 100644 --- a/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt +++ b/app/src/main/java/io/legado/app/ui/widget/KeyboardToolPop.kt @@ -49,6 +49,10 @@ class KeyboardToolPop( fun attachToWindow(window: Window) { window.decorView.viewTreeObserver.addOnGlobalLayoutListener(this) + contentView.measure( + View.MeasureSpec.UNSPECIFIED, + View.MeasureSpec.UNSPECIFIED, + ) } override fun onGlobalLayout() { @@ -60,7 +64,7 @@ class KeyboardToolPop( val preShowing = mIsSoftKeyBoardShowing if (abs(keyboardHeight) > screenHeight / 5) { mIsSoftKeyBoardShowing = true // 超过屏幕五分之一则表示弹出了输入法 - rootView.setPadding(0, 0, 0, 100) + rootView.setPadding(0, 0, 0, contentView.measuredHeight) if (!isShowing) { showAtLocation(rootView, Gravity.BOTTOM, 0, 0) }