Page scrolling, bottom view showing and hiding Detailed android

To achieve this, the page layout is this.

 

Red box picture focus.

CoordinatorLayout FramLayout also belongs to, has its own internal LayoutParams constructor calls parseBehavior analytical behavior properties, obtained by reflection behavior character string corresponding to the class name , and instantiate. CoordinatorLayout sliding mechanism in a nested, nested view the parent and child view sliding interaction mechanisms. Parent view to achieve NestedScrollingParent interfaces, sub-view realization NestedScrollingChild interfaces, then each implement a NestedScrollingHelper helper class, interactive helper view and the parent view. Event starts sliding recycleView, call the event and slide down in the event of startNestedScroll method, call NestedScrollingHelper of startNestedScroll method, and then call ViewParentCompat of onStartNestedScroll method, call the parent view (CoordinatorLayout) of onStartNestedScroll , throughoutCoordinatorLayout sub-view, get sub-view of layoutParams, call layoutParams of getBehavior , inherited from the acquisition Behavior subclass , call the subclass onStartNestedScroll , display processing view of the inside and hide.

 

If the processing behavior custom view can be customized class inherits from CoordinatorLayout.Behavior, to achieve public ScaleBehavior (Context context, AttributeSet attrs ) two-argument constructor, override public boolean onStartNestedScroll (@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @ nonNull View directTargetChild, @NonNull View target, int axes, int type) method and returns true,

And rewrite public void onNestedScroll (@NonNull CoordinatorLayout coordinatorLayout, @NonNull V child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) method, in which view the animation, and the like.

 

Guess you like

Origin www.cnblogs.com/diyigechengxu/p/11495778.html