I'm dynamically injecting a content view into the CoordinatorLayout
and would now like to apply a layout_below
property to the injected view so that it isn't hidden behind the AppBar
.
Is there any way to do this at runtime from code instead of xml properties of the annotation?
Taking one step back and building the entire view in plain xml, I realized that
layout_below
is not the property I needed for my use case: placing the content view below the app bar. I did not make this clear in my question though, as I assumedlayout_below
would be the proper option for that.In fact, to insert a non scrolling view into the
CoordinatorLayout
it should first be wrapped with aandroid.support.v4.widget.NestedScrollView
. Then, to avoid its content being hidden behind the app bar, it is necessary to update its behavior toandroid.support.design.widget.AppBarLayout.ScrollingViewBehavior
. Otherwise a default behavior is used which will hide behind the app bar.