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
You can try spinnerMode="dialog" but it is just a workaround, not the right answer. Because it will display a new window with a dialog.
So here is the way do to it. It will automatically fit the content.
It strongly depends how you set up your custom layout. May i suggest you to write your own xml file myspinner_custom_dropdown.xml. Recommanded way is now ConstraintLayout from androidX.
Important : you have yo use your custom layout with your adapter
dataAdapter.setDropDownViewResource(R.layout.myspinner_custom_dropdown);
That's all, you do not need some kinds of hardcored attributes in your spinner declaration.