I use SearchableSpinner widget, it is a great spinner, but there is a problem when I want to open the spinner by clicking on a button.
I used performClick() but instead of showing the searchable dialog, the standard one shows up, the searchable dialog appears only if the user clicks on the spinner, I also tried callOnClick() and didn't work.
Searchable Dialog:

Standard Spinner:

Try this:
yourSearchableSpinner.onTouch(view, MotionEvent.obtain(1, 1, MotionEvent.ACTION_UP, 1, 1, 1));
In fragment, you can get view as:
View view;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
this.view = view;
...
}
In activity, you can get view as:
View view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.your_layout);
view = findViewById(R.id.your_root_view);
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With