push activity on the right when open drawer

后端 未结 8 2036
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 11:29

I have implemented drawerlayout which slides from the right but it does not shift the activity the right like facebook does (See below image). How do I push the current acti

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 11:49

     ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
                private float scaleFactor = 4f;
                @Override
                public void onDrawerSlide(View drawerView, float slideOffset) {
                    super.onDrawerSlide(drawerView, slideOffset);
                    float slideX = drawerView.getWidth() * slideOffset;
                    content.setTranslationX(slideX);
                    content.setScaleX(1 - (slideOffset / scaleFactor));
                    content.setScaleY(1 - (slideOffset / scaleFactor));
                }
            };
    

提交回复
热议问题