建议添加控制折叠展开的接口
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();
很棒的建议,已更新