问题
I have an unwanted problem by default in spinner view.
On Android 2.2 when I double click any spinner it opens twice, Upon pressing the back button the 2nd spinner closes but 1st one remains open.
I need a fix for this issue.
I only want the spinner to show once regardless of how many times the user clicks it.
This problem doesn't exist in Android 4.0+.
Is there a way to fix this bug?
回答1:
You can use setEnabled(false) when user click on item first time to prevent further interaction, and make setEnabled(true) when you need.
回答2:
You can use something like this,
Possibly in your onClick()
;
view.setEnabled(false);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
view.setEnabled(true);
}
}, TIME_IN_MS);
来源:https://stackoverflow.com/questions/16460644/android-preventing-double-click-on-a-spinner