I'm trying to add a FloatingActionButton to a CoordinatorLayout in my Activity's onCreate(). This is basically working. It receives Coordinator.LayoutParams with gravity = BOTTOM | RIGHT. When the Snackbar (attached to the same coordinator) pops in, it underlays the button though.
If I embed the FloatingActionButton into the coordinator via xml it works as advertised.
The embedded button and the dynamically added one are based on the same xml source, added via <include /> (working) and via addView( inflate( ... ) ) (not working). The view hierarchy in the debugging tool is identical.
One strange thing I noticed here, is that in onCreate(), after inflating/adding, the behavior of the fab is null. Before the Snackbar appears, it magically received a FloatingActionButton.Behavior.
Manually setting the FloatingActionButton.Behavior while adding the view did not help.
It would help me a lot to understand what is going on, if I could access the source code of the design library, but it seems to be not available yet.
By now inflating a
FloatingActionButtonin code, when there is aSnackbarin the sameCoordinatorLayout, should work just fine.