MaterialSpinner
MaterialSpinner copied to clipboard
performClick() doesn't show Dropdown, Dialog or BottomSheet
Summary: performClick()
doesn't work on MaterialSpinner: Dropdown, Dialog or BottomSheet doesn't show.
In my application, there is a holder around the Spinner. When this holder is clicked, the Spinner should show a Dropdown or Dialog. This works for the normal Spinner. Instead of a Dropdown or Dialog I need a BottomSheet and that's why I started using MaterialSpinner. Unfortunately, performClick()
doesn't work for MaterialSpinner. No Dropdown, Dialog or BottomSheet is shown. I was wondering if there's a workaround for this or if this can be fixed.
holder.mStateSpinnerHolder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.mStateSpinner.performClick();
}
});
Edit: I extracted the code of this library to a project class and I added this method as a temporary workaround:
override fun performClick(): Boolean {
popup.show(0)
return super.performClick()
}
This shows the expected behaviour. Next to this method, maybe another method performClick(position: Int)
should be added too to maintain the position, but this is not needed in all cases. Could this be updated in the library?
Hi @DaphnevdVeeke can you try version master-3acdbe1cc8-1
?
Hi @tiper, it seems that I cannot implement 'com.github.tiper:MaterialSpinner:1.4.2' yet, it fails to resolve. Since I don't have too much time today, I won't be able to manually add the entire library to the project before Thursday. I'll get back with you on Thursday or Friday (or earlier if 1.4.2 is released).
Hi @DaphnevdVeeke you do not need to add the lib manually to your project, just use implementation 'com.github.tiper:MaterialSpinner:master-3acdbe1cc8-1'
.
Cheers.
Still gives me errors.
@DaphnevdVeeke sorry for the inconvenience if you still can, please try implementation 'com.github.tiper:MaterialSpinner:master-SNAPSHOT
@tiper No problem. That one works indeed. Unfortunately, performClick() is still not working. The BottomSheet is not showing up.