Closed lividoul closed 1 year ago
I've reproduced this and you're correct @lividoul, the ExpandableFab
does not honor visibility set through XML.
As a work around, you can get a reference to the ExpandableFab programmatically in your Fragment/Activity and immediately call hide
on it, to effectively do the same thing.
For example, in a Fragment:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val expandableFabLayout = view.findViewById<ExpandableFabLayout>(R.id.expandable_fab_layout)
expandableFabLayout.getCurrentConfiguration().efab?.hide()
}
I've reproduced this and you're correct @lividoul, the
ExpandableFab
does not honor visibility set through XML.As a work around, you can get a reference to the ExpandableFab programmatically in your Fragment/Activity and immediately call
hide
on it, to effectively do the same thing.For example, in a Fragment:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val expandableFabLayout = view.findViewById<ExpandableFabLayout>(R.id.expandable_fab_layout) expandableFabLayout.getCurrentConfiguration().efab?.hide() }
Doing that show up animation does not perform when I call efab.show() later
@lividoul,
Which animation on the ExpandableFab (not the FabOptions, correct?) are you expecting to play when you unhide it?
@kabumere,
The default show up animation of the fab. When you call hide() immediately the animation doesn't perform on the first time you call show(). But if after the first show() you call hide() for a second time and then show() again, the animation will perform. I think this happens on the default fab as well. That's why you set visibility="invisible" on XML.
@lividoul the ExpandableFab itself does not have a default animation when it's first shown, it's just present in the UI. If you hide the ExpandableFab, then show it later after some condition is met, the ExpandableFab will simply appear in its correct position. Then upon pressing the ExpandableFab, the FabOptions and optional Overlay will animate appropriately.
Please show a gif of what you're expecting if I'm misunderstanding you.
@kabumere The same happens with android:visibility="gone"
@MickeCast,
Please show a gif of what animations you're expecting to play after unhiding the ExpandableFab.
Closing due to inactivity. If anyone else experiences this issue, please be ready to show/explain the exact behavior you're expecting from the widget.
I want to begin my fragment with the fab on invisible visibility mode to then call the method .show() to the fab appear with animation. android:visibility="invisible" is not working on xml