githubwing / ByeBurger

An Android behavior library let your titlebar or bottom navigation hiding on scroll ,极其简便的快速实现滑动隐藏标题栏和导航栏

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

建议添加控制折叠展开的接口

Luogjy opened this issue · comments

我在自己的项目的代码:
---在ByeBurgerBehavior中添加:
protected AnimateHelper mAnimateHelper;
public static ByeBurgerBehavior from(View view) {//参考BottomSheetBehavior
ViewGroup.LayoutParams params = view.getLayoutParams();
if (!(params instanceof CoordinatorLayout.LayoutParams)) {
throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
}
CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
if (!(behavior instanceof ByeBurgerBehavior)) {
throw new IllegalArgumentException(
"The view is not associated with ByeBurgerBehavior");
}
return (ByeBurgerBehavior) behavior;
}

public void collaps() {
    if (mAnimateHelper != null) {
        mAnimateHelper.hide();
    }
}

public void expand() {
    if (mAnimateHelper != null) {
        mAnimateHelper.show();
    }
}

---使用:
ByeBurgerBehavior behavior = ByeBurgerBehavior.from(bottomBar);
behavior.expand();

很棒的建议,已更新