Skip to content

Instantly share code, notes, and snippets.

@n3vr0s
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save n3vr0s/24904290d44e32dc752b to your computer and use it in GitHub Desktop.

Select an option

Save n3vr0s/24904290d44e32dc752b to your computer and use it in GitHub Desktop.
Collapsing Toolbar for certain fragments
package pl.amstard.goodfood.views;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.View;
public class MyCoordinatorLayout extends CoordinatorLayout {
private boolean allowForScrool = false;
public MyCoordinatorLayout(Context context) {
super(context);
}
public MyCoordinatorLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
return allowForScrool && super.onStartNestedScroll(child, target, nestedScrollAxes);
}
public boolean isAllowForScrool() {
return allowForScrool;
}
public void setAllowForScrool(boolean allowForScrool) {
this.allowForScrool = allowForScrool;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment