sliding-panel
项目地址:PierfrancescoSoffritti/sliding-panel
简介:Android sliding panel that is part of the view hierarchy, not above it.
标签:
A ViewGroup that implements a sliding panel that is part of the view hierarchy, not above it.
Difference from other libraries
All other implementations of the bottom sheet pattern and sliding panel patternimplement a panel that sits above all the other Views of the app. When the panel is collapsed (but visible) the only way to set its position is by using a peek factor (its distance from the bottom of the screen).
With this library the sliding panel is placed exactly where it is supposed to be in the view hierarchy, just like it would be in a vertical (or horizontal) LinearLayout
. It doesn't sit above other Views.
Overview
SlidingPanel
is a ViewGroup exending FrameLayout
.
It has exacly two children: a non sliding view and a sliding view.
- The non sliding view is just a view that doesn't move, positioned as if
SlidingPanel
was aLinearLayout
. - The sliding view is a View that can be dragged by the user. It slides over the non sliding view, both vertically and horizontally.
The sliding view can be collapsed or expanded.
- When collapsed, the sliding view is exactly where it would be if
SlidingPanel
was a LinearLayout. - When expanded, the sliding view is positioned to exactly cover the non sliding view. (Therefore the maximum amount of movement allowed to the sliding view is equal to the height (or width) of the non sliding view)