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 ce1f7e710..d0f138e1f 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 @@ -105,7 +105,12 @@ class ReadBookActivity : ReadBookBaseActivity(), } private var menu: Menu? = null private val textActionMenu: TextActionMenu by lazy { - TextActionMenu(this, this) + TextActionMenu(this, this).apply { + contentView.measure( + View.MeasureSpec.UNSPECIFIED, + View.MeasureSpec.UNSPECIFIED + ) + } } override val scope: CoroutineScope get() = this @@ -469,10 +474,6 @@ class ReadBookActivity : ReadBookBaseActivity(), * 显示文本操作菜单 */ override fun showTextActionMenu() = binding.run { - textActionMenu.contentView.measure( - View.MeasureSpec.UNSPECIFIED, - View.MeasureSpec.UNSPECIFIED - ) val popupHeight = textActionMenu.contentView.measuredHeight val x = textMenuPosition.x.toInt() var y = textMenuPosition.y.toInt() - popupHeight diff --git a/app/src/main/res/layout/popup_action_menu.xml b/app/src/main/res/layout/popup_action_menu.xml index 12b5ebfc5..238593f51 100644 --- a/app/src/main/res/layout/popup_action_menu.xml +++ b/app/src/main/res/layout/popup_action_menu.xml @@ -7,7 +7,4 @@ android:background="@drawable/shape_card_view" android:padding="5dp" android:orientation="horizontal" - app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager"> - - - + app:layoutManager="com.google.android.flexbox.FlexboxLayoutManager" /> \ No newline at end of file