Deploy AppBarLayout.OnOffsetChangedListener to the action. In the onOffsetChanged method, adjust the edge of the view below to match the current scroll.
@Override public void onOffsetChanged(AppBarLayout appBarLayout, int i) { RelativeLayout.LayoutParams bottomLayoutParams = (RelativeLayout.LayoutParams)fragment.bottomLayout.getLayoutParams(); bottomLayoutParams.setMargins(0,0,0,(actionBarHeight + i)); fragment.bottomLayout.setLayoutParams(bottomLayoutParams); }
Here, the fragment is an instance of your fragment, and bottomLayout is the view below.
arkit
source share