我的应用程序中有一个导航抽屉。当我打开抽屉并希望其在内容下方打开时,我更改了一些属性以获取图像what I have。但是我想要的是显示在图像What I want to reach中,您可以在这里找到我的代码:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
final CoordinatorLayout content = (CoordinatorLayout) findViewById(R.id.content);
drawerLayout.setScrimColor(Color.TRANSPARENT);
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
private float scaleFactor = 6f;// private float scaleFactor = 6f;
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
float slideX = drawerView.getWidth() * slideOffset;
content.setTranslationX(slideX);
content.setScaleX(1 );
content.setScaleY(1 - (slideOffset / scaleFactor));
}
};
drawerLayout.setScrimColor(Color.TRANSPARENT);
drawerLayout.setDrawerElevation(0f);
drawerLayout.addDrawerListener(actionBarDrawerToggle);