I have a coordinator layout with a recyclerview which I would like to add programmatically. The reason why it\'s added programatically is because different fragments which infla
Accepted answer is correct but the provided code is not compilable. So here is a complete example
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams)
view.getLayoutParams();
params.setBehavior(new AppBarLayout.ScrollingViewBehavior(view.getContext(), null));
2nd param is AttributeSet
and it is fine to have it as null
although it is not marked as Nullable
in support lib.