drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
public void closeDrawer(@NonNull View drawerView, boolean animate) {
        if (!isDrawerView(drawerView)) {
            throw new IllegalArgumentException("View " + drawerView + " is not a sliding drawer");
        }

        final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
        if (mFirstLayout) {
            lp.onScreen = 0.f;
            lp.openState = 0;
        } else if (animate) {
            lp.openState |= LayoutParams.FLAG_IS_CLOSING;

            if (checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {
                mLeftDragger.smoothSlideViewTo(drawerView, -drawerView.getWidth(),
                        drawerView.getTop());
            } else {
                mRightDragger.smoothSlideViewTo(drawerView, getWidth(), drawerView.getTop());
            }
        } else {
            moveDrawerToOffset(drawerView, 0.f);
            updateDrawerState(lp.gravity, STATE_IDLE, drawerView);
            drawerView.setVisibility(INVISIBLE);
        }
        invalidate();
    }
/**
     * Close the specified drawer view.
     *
     * @param drawerView Drawer view to close
     * @param animate Whether closing of the drawer should be animated.
     */
Close the specified drawer view.
@param drawerView Drawer view to close
@param animate Whether closing of the drawer should be animated.
Close the specified drawer view . @param drawerView Drawer view to close @param animate Whether closing of the drawer should be animated .
public void closeDrawer(@NonNull View drawerView, boolean animate) {
        if (!isDrawerView(drawerView)) {
            throw new IllegalArgumentException("View " + drawerView + " is not a sliding drawer");
        }
        final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
        if (mFirstLayout) {
            lp.onScreen = 0.f;
            lp.openState = 0;
        } else if (animate) {
            lp.openState |= LayoutParams.FLAG_IS_CLOSING;
            if (checkDrawerViewAbsoluteGravity(drawerView, Gravity.LEFT)) {
                mLeftDragger.smoothSlideViewTo(drawerView, -drawerView.getWidth(),
                        drawerView.getTop());
            } else {
                mRightDragger.smoothSlideViewTo(drawerView, getWidth(), drawerView.getTop());
            }
        } else {
            moveDrawerToOffset(drawerView, 0.f);
            updateDrawerState(lp.gravity, STATE_IDLE, drawerView);
            drawerView.setVisibility(INVISIBLE);
        }
        invalidate();
    }
public void closeDrawer ( @ NonNull View drawerView , boolean animate ) { if ( ! isDrawerView ( drawerView ) ) { throw new IllegalArgumentException ( "View " + drawerView + " is not a sliding drawer" ) ; } final LayoutParams lp = ( LayoutParams ) drawerView . getLayoutParams ( ) ; if ( mFirstLayout ) { lp . onScreen = 0.f ; lp . openState = 0 ; } else if ( animate ) { lp . openState |= LayoutParams . FLAG_IS_CLOSING ; if ( checkDrawerViewAbsoluteGravity ( drawerView , Gravity . LEFT ) ) { mLeftDragger . smoothSlideViewTo ( drawerView , - drawerView . getWidth ( ) , drawerView . getTop ( ) ) ; } else { mRightDragger . smoothSlideViewTo ( drawerView , getWidth ( ) , drawerView . getTop ( ) ) ; } } else { moveDrawerToOffset ( drawerView , 0.f ) ; updateDrawerState ( lp . gravity , STATE_IDLE , drawerView ) ; drawerView . setVisibility ( INVISIBLE ) ; } invalidate ( ) ; }
Close the specified drawer view.
Close the specified drawer view .