Fragments
SeaRoth opened this issue · 2 comments
I'm trying to get this to work with fragments - is that possible?
I'm using MVVM and I declare my onCreateOptionsMenu inside a Fragment instead of an Activity.
I've tried a few tactics but I keep running into errors and I feel like there's something I'm not seeing
bindSearchView
is actually an extension function extending either an Activity
or ViewGroup
. You have two options:
-
Add it in your activity, where you can show and hide it as you wish after binding. This is what I do, as toolbars are typically linked to activities vs fragment.
-
Add it to any general viewgroup. Just make sure you call it from that viewgroup. You may need to manually adjust the menu y offset if your viewgroup doesn't fill your parent.
Wow that's embarrassing (because it was so easy, lol) - thank you for helping me!!!!!!!!!!!! =)