Spinner Dialog Box Does Not Adjust Screen Width

I am using Spinner with android:spinnerMode="dropdown" . I also set android:configChanges="orientation|keyboardHidden|screenSize" to prevent my Activity from being recreated. when I am in Landscape mode and click Spinner , it appears under Spinner and has a width the same as the Spinner button, now when I rotate the screen to portrait mode, the width of the Spinner button decreases in accordance with the size of the screen, but the pop-up the dialog box does not reduce its width.

Portrait screen mode: enter image description here

LAndscape Mode Screen enter image description here

I thought about closing the popup and reopening it on the screen, but I did not find a way to close the popup dialog.

+4
source share
2 answers

When calling the onConfigurationChanged() method on onConfigurationChanged() spinner.invalidate();

+2
source

I also had this problem. I ended up notifyDatasetChanged() on the spinnerAdapter in onConfigurationChanged() , and it worked.

+2
source

All Articles