我有一个弹出菜单,当它打开时,如果打开了应用程序抽屉菜单,则弹出菜单位于其上方。我试过玩 elevation 和 windowLayoutType 但我似乎无法让应用程序抽屉显示在它上面。
在片段中,我显示附加到 RecyclerView 的 itemView 的弹出窗口。
val inflater = LayoutInflater.from(context)
val popupView = inflater.inflate(R.layout.chat_node_floating_menu, null)
popupBinding = ChatNodeFloatingMenuBinding.bind(popupView)
popupWindow = PopupWindow(
popupView,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT
)
popupWindow.apply {
isAttachedInDecor = true
overlapAnchor = false
// windowLayoutType = WindowManager.LayoutParams.LAST_SUB_WINDOW
}
val viewHolder = binding.chatNodeRecyclerView.findViewHolderForAdapterPosition(position) as ChatNodeAdapter.ChatNodeViewHolder
nodeItemBinding = viewHolder.binding
val anchorView = nodeItemBinding!!.chatNodeTopGuide
popupWindow.showAsDropDown(anchorView, xOffset, yOffset)