The AppBarLayout
has a listener to be notified of changes of offset
.
I believe it is possible to be notified when it is completely collapsed or expanded as follows:
AppBarLayout.OnOffsetChangedListener listener = new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if(collapsingToolbar.getHeight() + verticalOffset < 2 * ViewCompat.getMinimumHeight(collapsingToolbar)) {
// CollapsingToolbar esta colapsado
} else {
// CollapsingToolbar esta expandindo
}
}
};
appBar.addOnOffsetChangedListener(listener);
Source: link