ListPopupWindow not obeying WRAP_CONTENT width spec

前端 未结 9 1806
执念已碎
执念已碎 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:38

    I believe that your issue lies with your ArrayAdapter using simple_list_item_1. If you look at the source code for that element it has the property of

    android:layout_width="match_parent"
    

    If you look at the source here you can create your own new_list_item_1.xml with the same info but changing it to android:layout_width="wrap_content" and then use that in your ArrayAdapter

提交回复
热议问题