androidxmlandroid-layoutandroid-fragmentsslidingpanelayout

Android SlidingPaneLayout Fade


I am trying a prototype app with SlidingPaneLayout. My SlidingPaneLayout is gray and body view is pure white. but when i slide in, the small visible area of body page goes slightly dark or overlaying with dark screening. all i want is pure original white color of that body view.

I tried couple of Methods to switch off these but seems impossible. such as

SlidingPaneLayout sp = (SlidingPaneLayout) findViewById(R.id.mainSlider);
sp.setHorizontalFadingEdgeEnabled(false);

or following property in XML

<android.support.v4.widget.SlidingPaneLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mainSlider"
    android:requiresFadingEdge="none" <!-- try one -->
    android:fadingEdgeLength="0dp"  <!-- try two -->
    android:fadingEdge="none"  <!-- try three -->
    tools:context=".MainActivity">

enter image description here

enter image description here

Any one of you, have you ever done this successfully?


Solution

  • You can set the fade color to transparent:

    SlidingPaneLayout sp = (SlidingPaneLayout) findViewById(R.id.mainSlider);
    sp.setSliderFadeColor(getResources().getColor(android.R.color.transparent));