@Override public boolean onDependentViewChanged(CoordinatorLayout parent, final View child, View dependency) { init((RecyclerView) child, dependency); //recyclerView Top始终处于ZoomHeaderView bottom child.setY(dependency.getY() + dependency.getHeight()); ViewPager viewPager = ((ZoomHeaderView) dependency).getViewPager(); for (int i = 0; i <viewPager.getChildCount(); i++) { //对所有item进行缩 changeView(child, dependency, viewPager, i); } return super.onDependentViewChanged(parent, child, dependency); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, RelativeLayout child, View dependency) { Log.d("BBBBBBB", dependency.getY() + ""); return super.onDependentViewChanged(parent, child, dependency); } }
/** * 当被监听的view发生改变时回调 * 可以在此方法里面做一些响应的联动动画等效果 */ @Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { int offset = dependency.getTop() - child.getTop(); ViewCompat.offsetTopAndBottom(child, offset); return super.onDependentViewChanged(parent, child, dependency); } }
return super.onDependentViewChanged(parent, child, dependency);
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { if (totalScrollRange == -1 || splitHeight == -1) { totalScrollRange = ((AppBarLayout) dependency).getTotalScrollRange(); splitHeight = (int) (totalScrollRange * multiplier); } if (splitHeight > 0 && dependency instanceof AppBarLayout) { if (!isAnimationIng) { // Log.e("Behavior", "dependency.getY:" + dependency.getY() + " totalScrollRange:" + totalScrollRange + " splitHeight:" + splitHeight); if (totalScrollRange + dependency.getY() <= splitHeight && child.getVisibility() == View.VISIBLE) { hide(child); } else if (totalScrollRange + dependency.getY() >= splitHeight && child.getVisibility() == View.GONE) { show(child); } } } if (totalScrollRange != -1) { if (totalScrollRange + dependency.getY() == 0) { scrollToTop(child, dependency); } else if (dependency.getY() == 0) { scrollToBottom(child, dependency); } } return super.onDependentViewChanged(parent, child, dependency); }
/** * 当被依赖的View 状态(如:位置、大小)发生变化时,这个方法被调用 * @param parent * @param child * @param dependency * @return */ @Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { return super.onDependentViewChanged(parent, child, dependency); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) dependency.getLayoutParams(); if (lp.getBehavior() instanceof TargetBehavior) { TargetBehavior behavior = (TargetBehavior) lp.getBehavior(); moveHeaderView(behavior, child); return true; } return super.onDependentViewChanged(parent, child, dependency); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { return super.onDependentViewChanged(parent, child, dependency); } }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, ImageView child, View dependency) { return super.onDependentViewChanged(parent, child, dependency); } }