SlidingPaneLayout setCoveredFadeColor () and setSl

2019-07-07 12:58发布

问题:

I'm using the SlidingPaneLayout and want to set gray fade color on left pane when the slider right pane is open and a transparent fade color on the left pane when the right pane is closed and left pane is fully visible.
I know this is the default behaviour of the SlidingPaneLayout , but with default implementation I'm facing issues in the landscape mode wherein my slider left pane always remains faded and takes no click events even if right slide is closed.
I implemented the SlidingPaneLayout.SimplePanelSlideListener and managed the fade colors in onPanelOpened() and onPanelClosed() But I'm nit sure which function should I use for this... setCoveredFadeColor() or setSliderFadeColor()?
What is the exact difference between these 2 functions?

Any help is much appreciated. Thanks!

回答1:

From the docs:

setSliderFadeColor(int color) 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.

setCoveredFadeColor(int color) Set the color used to fade the sliding pane out when it is slid most of the way offscreen.

In my experience, I've found that the panel that gets covered needs to be at least 320dp wide for these two fade colours to work.