Below is the code of my coordinator layout. It works well.
You can reduce the alpha of the RelativeLayout as you scroll up by hooking up an AppBarLayout.OnOffsetChangedListener to the AppBarLayout. Below is the code I used in my app.
appBar = (AppBarLayout) findViewById(R.id.app_bar_layout);
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
relativeLayoutToFadeOut.setAlpha(1.0f - Math.abs(verticalOffset / (float)
appBarLayout.getTotalScrollRange()));
}
});