Android - PopupWindow above a specific view

前端 未结 8 533
孤城傲影
孤城傲影 2020-12-30 23:50

I am developing an application for Android and I am using a popup window when the user clicks a specific menu bar object(consisting of small images lined up horizontally) on

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 23:53

    You just needed to move the popupWindow by the height of its anchor using the yoff parameter in the showAsDropDown(View anchor, int xoff, int yoff) syntax.

    popupWindow.showAsDropDown(anchor, 0, -anchor.getHeight()+popupView.getHeight);
    

    Also, be aware that if the max height allowed to anchor does not allow for the transformation, the popup might not show up properly.

提交回复
热议问题