diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index c6294c290..43c6ef541 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -406,8 +406,15 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } } textActionMenu?.let { popup -> + val popupHeight = popup.contentView.measuredHeight val x = text_menu_position.x.toInt() - val y = text_menu_position.y.toInt() - popup.contentView.measuredHeight + var y = text_menu_position.y.toInt() - popupHeight + if (y < statusBarHeight) { + y = (cursor_left.y + cursor_left.height).toInt() + } + if (cursor_right.y > y && cursor_right.y < y + popupHeight) { + y = (cursor_right.y + cursor_right.height).toInt() + } if (!popup.isShowing) { popup.showAtLocation(text_menu_position, Gravity.TOP or Gravity.START, x, y) } else {