Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DropDown menu doesn't work when change fragment #145

Open
andreachiera opened this issue Jan 13, 2021 · 1 comment
Open

DropDown menu doesn't work when change fragment #145

andreachiera opened this issue Jan 13, 2021 · 1 comment

Comments

@andreachiera
Copy link

andreachiera commented Jan 13, 2021

If i use MaterialSpinner in a fragment, and i reuse this fragment later than dropdown menu doesn't work. I think that the problem is related to canShowPopup() method, maybe the component is detached from activity and getActivity() return null.

Momentary solution:
MaterialSpinner.getPopupWindow().showAsDropDown(MaterialSpinner);

@AndrewGlukhoff
Copy link

solution:
override fun onClick(v: View?) {
val popUp = yourSpinner?.popupWindow
if (popUp != null) {
if (!popUp.isShowing) {
popUp.showAsDropDown(v)
}
}
}
Dont't forget declare yourSpinner with
android:focusableInTouchMode="false"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants