Search code examples
javaandroidslidingmenuandroid-sliding

How to hide shadow when open SlidingMenu?


In my application for set menu i use SlidingMenu and for this i write below code.
In my codes SlidingMenu it's work and not error.
But in my code when open SlidingMenu set black shadow to my mainLayout.
I want when open SlidingMenu not set shadow to my mainLayout.

My codes:

mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawer_layout, R.drawable.icon_alarm, R.string.app_name, R.string.app_name) {
    public void onDrawerClosed(View view) {

    }

    public void onDrawerOpened(View drawerView) {

    }
    @SuppressLint("NewApi")
    @Override
    public void onDrawerSlide(View drawerView, float slideOffset) {
        super.onDrawerSlide(drawerView, slideOffset);
        layoutRoot.setTranslationX(-slideOffset * drawerView.getWidth());
        drawer_layout.bringChildToFront(drawerView);
        drawer_layout.requestLayout();
    }
};
drawer_layout.setDrawerListener(mDrawerToggle);

How can i it? please help me


Solution

  • You just need to do write one line as following :

     drawerLayout.setScrimColor(ContextCompat.getColor(context,android.R.color.transparent));
    

    It will remove the black shadow while you open navigation drawer. You can do it by programmatically.