public class BugFixedSlidingPaneLayout
SlidingPaneLayout provides a horizontal, multi-pane layout for use at the top level of a UI. A left (or first) pane is treated as a content list or browser, subordinate to a primary detail view for displaying content.
Child views may overlap if their combined width exceeds the available width in the SlidingPaneLayout. When this occurs the user may slide the topmost view out of the way by dragging it, or by navigating in the direction of the overlapped view using a keyboard. If the content of the dragged child view is itself horizontally scrollable, the user may grab it by the very edge.
Thanks to this sliding behavior, SlidingPaneLayout may be suitable for creating layouts that can smoothly adapt across many different screen sizes, expanding out fully on larger screens and collapsing on smaller screens.
SlidingPaneLayout is distinct from a navigation drawer as described in the design guide and should not be used in the same scenarios. SlidingPaneLayout should be thought of only as a way to allow a two-pane layout normally used on larger screens to adapt to smaller screens in a natural way. The interaction patterns expressed by SlidingPaneLayout imply a physicality and direct information hierarchy between panes that does not necessarily exist in a scenario where a navigation drawer should be used instead.
Appropriate uses of SlidingPaneLayout include pairings of panes such as a contact list and subordinate interactions with those contacts, or an email thread list with the content pane displaying the contents of the selected thread. Inappropriate uses of SlidingPaneLayout include switching between disparate functions of your app, such as jumping from a social stream view to a view of your personal profile - cases such as this should use the navigation drawer pattern instead. (DrawerLayout implements this pattern.)
Like android.widget.LinearLayout, SlidingPaneLayout supports the use of the layout parameter layout_weight on child views to determine how to divide leftover space after measurement is complete. It is only relevant for width. When views do not overlap weight behaves as it does in a LinearLayout.
When views do overlap, weight on a slideable pane indicates that the pane should be sized to fill all available space in the closed state. Weight on a pane that becomes covered indicates that the pane should be sized to fill all available space except a small minimum strip that the user may use to grab the slideable view and pull it back over into a closed state.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BugFixedSlidingPaneLayout.LayoutParams |
static class |
BugFixedSlidingPaneLayout.SimplePanelSlideListener
No-op stubs for PanelSlideListener. If you only want to implement a subset of the listener methods you can extend this instead of implement the full interface.
|
| 构造器和说明 |
|---|
BugFixedSlidingPaneLayout() |
BugFixedSlidingPaneLayout() |
BugFixedSlidingPaneLayout() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
canScroll()
Tests scrollability within child views of v given a delta of dx.
|
boolean |
canSlide() |
boolean |
checkLayoutParams() |
boolean |
closePane()
Close the sliding pane if it is currently slideable. If first layout has already completed this will animate.
|
void |
computeScroll() |
void |
draw() |
boolean |
drawChild() |
android.view.ViewGroup.LayoutParams |
generateDefaultLayoutParams() |
android.view.ViewGroup.LayoutParams |
generateLayoutParams() |
android.view.ViewGroup.LayoutParams |
generateLayoutParams() |
int |
getCoveredFadeColor() |
int |
getParallaxDistance() |
int |
getSliderFadeColor() |
boolean |
isOpen()
Check if the layout is completely open. It can be open either because the slider itself is open revealing the left pane, or if all content fits without sliding.
|
boolean |
isSlideable()
Check if the content in this layout cannot fully fit side by side and therefore the content pane can be slid back and forth.
|
void |
onAttachedToWindow() |
void |
onDetachedFromWindow() |
boolean |
onInterceptTouchEvent() |
void |
onLayout() |
void |
onMeasure() |
void |
onRestoreInstanceState() |
android.os.Parcelable |
onSaveInstanceState() |
void |
onSizeChanged() |
boolean |
onTouchEvent() |
boolean |
openPane()
Open the sliding pane if it is currently slideable. If first layout has already completed this will animate.
|
void |
requestChildFocus() |
void |
setCoveredFadeColor()
Set the color used to fade the pane covered by the sliding pane out when the pane will become fully covered in the closed state.
|
void |
setPanelSlideListener() |
void |
setParallaxDistance()
Set a distance to parallax the lower pane by when the upper pane is in its fully closed state. The lower pane will scroll between this position and its fully open state.
|
void |
setShadowDrawable()
Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.
|
void |
setShadowResource()
Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.
|
void |
setSliderFadeColor()
Set the color used to fade the sliding pane out when it is slid most of the way offscreen.
|
void |
smoothSlideClosed() |
void |
smoothSlideOpen() |
public BugFixedSlidingPaneLayout()
public BugFixedSlidingPaneLayout()
public BugFixedSlidingPaneLayout()
public void setParallaxDistance()
Set a distance to parallax the lower pane by when the upper pane is in its fully closed state. The lower pane will scroll between this position and its fully open state.
public int getParallaxDistance()
BugFixedSlidingPaneLayout.setParallaxDistancepublic void setSliderFadeColor()
Set the color used to fade the sliding pane out when it is slid most of the way offscreen.
public int getSliderFadeColor()
public void setCoveredFadeColor()
Set the color used to fade the pane covered by the sliding pane out when the pane will become fully covered in the closed state.
public int getCoveredFadeColor()
public void setPanelSlideListener()
public void onAttachedToWindow()
public void onDetachedFromWindow()
public void onMeasure()
public void onLayout()
public void onSizeChanged()
public void requestChildFocus()
public boolean onInterceptTouchEvent()
public boolean onTouchEvent()
public void smoothSlideOpen()
public boolean openPane()
Open the sliding pane if it is currently slideable. If first layout has already completed this will animate.
public void smoothSlideClosed()
public boolean closePane()
Close the sliding pane if it is currently slideable. If first layout has already completed this will animate.
public boolean isOpen()
Check if the layout is completely open. It can be open either because the slider itself is open revealing the left pane, or if all content fits without sliding.
public boolean canSlide()
public boolean isSlideable()
Check if the content in this layout cannot fully fit side by side and therefore the content pane can be slid back and forth.
public boolean drawChild()
public void computeScroll()
public void setShadowDrawable()
Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.
public void setShadowResource()
Set a drawable to use as a shadow cast by the right pane onto the left pane during opening/closing.
public void draw()
public boolean canScroll()
Tests scrollability within child views of v given a delta of dx.
public android.view.ViewGroup.LayoutParams generateDefaultLayoutParams()
public android.view.ViewGroup.LayoutParams generateLayoutParams()
public boolean checkLayoutParams()
public android.view.ViewGroup.LayoutParams generateLayoutParams()
public android.os.Parcelable onSaveInstanceState()
public void onRestoreInstanceState()