It is completely incomprehensible why a spinner behaves this way. Pay attention to the scroll bar. And what Spinner, AppCompatSpinner behave the same.
@zTrap, @kizoso, I even found a curious code inside the SDK that I suspect. Inside the android.widget.ListPopupWindow class, the following listener was detected:
private class PopupTouchInterceptor implements OnTouchListener { public boolean onTouch(View v, MotionEvent event) { final int action = event.getAction(); final int x = (int) event.getX(); final int y = (int) event.getY(); if (action == MotionEvent.ACTION_DOWN && mPopup != null && mPopup.isShowing() && (x >= 0 && x < mPopup.getWidth() && y >= 0 && y < mPopup.getHeight())) { mHandler.postDelayed(mResizePopupRunnable, EXPAND_LIST_TIMEOUT); } else if (action == MotionEvent.ACTION_UP) { mHandler.removeCallbacks(mResizePopupRunnable); } return false; } } private class ResizePopupRunnable implements Runnable { public void run() { if (mDropDownList != null && mDropDownList.isAttachedToWindow() && mDropDownList.getCount() > mDropDownList.getChildCount() && mDropDownList.getChildCount() <= mListItemExpandMaximum) { mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED); show(); } } }
It is just very similar to what happens if the number of elements in the spinner is more than what is placed on the screen — the show method is called if you don’t remove your finger in a quarter of a second (EXPAND_LIST_TIMEOUT). But then it is completely incomprehensible to me why and how it works in other projects ...
<androidx.appcompat.widget.AppCompatSpinner android:id="@+id/my_spinner" android:layout_width="wrap_content" android:minWidth=100dp android:entries="@array/spinner_data" />
And it’s not possible to reproduce even on another project. Although on any activations and fragments of the current project is reproduced. - Kirill Vlasov