user496854 user496854 - 1 year ago 84
Android Question

On Android, is there any way to disable a Spinner's long-press behavior?

The default spinner behavior is that when it's "closed", longpressing on it will "open" it and show you the dropdown view. I find this behavior to be potentially very problematic for the user. For example, if they're trying to scroll something on the screen, and happen to "grab" a spot that has a spinner, then instead of scrolling, it'll open the dropdown view after a second or so, and the user is basically left with their finger on one of the dropdown options (which they can now accidentally press).

So, I'd like to disable that long-press behavior, and have the spinner "open" when only it's clicked, and not long-pressed. Is that possible?

Answer Source

So, I've figured out a relatively easy way to do this, even though it's not very elegant. Basically, I created a transparent overlay view on top of the Spinner, and set it to have an OnClickListener that just triggers a Spinner's click.


        android:layout_height="40dip" />

    <View android:id="@+id/spinner_overlay"
        android:layout_alignBottom="@id/spinner"  />


        View spinnerOverlay = findViewById(;
        spinnerOverlay.setOnClickListener(new OnClickListener(){
            public void onClick(View v) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download