How can I make the spinner width same as largest available item width

前端 未结 7 1576
天涯浪人
天涯浪人 2021-01-31 07:44

I realize even I use wrap_content for my spinner (I avoid using match_parent as I do not want the spinner overly long), and using match_parent

7条回答
  •  抹茶落季
    2021-01-31 07:53

    You should be able to get the effect you want by specifying the width of the dropdown as WRAP_CONTENT:

    
    

    This will measure up to 15 items in the spinner's adapter to determine the width it should use.

提交回复
热议问题