ListPopupWindow not obeying WRAP_CONTENT width spec

前端 未结 9 1551
执念已碎
执念已碎 2021-02-02 07:12

I\'m trying to use ListPopupWindow to show a list of strings via an ArrayAdapter (eventually this will be a more complex custom adapter). Code is below. As shown in

9条回答
  •  旧巷少年郎
    2021-02-02 07:25

    Another solution is to set a 0dp height view in your layout xml to use as an anchor.

    
    

    then set the anchor view sometime before calling the show() method.

    listPopupWindow.setAnchorView(popupAnchor);
    listPopupWindow.show();
    

提交回复
热议问题