private void Slidingdrawerfunc() { mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // set a custom shadow that overlays the main content when the drawer // opens // mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener mDrawerLayout.setScrimColor(Color.TRANSPARENT); }
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.rbtn_pink) { mDrawer.setScrimColor(getResources().getColor(R.color.color_e81d62)); // 设置滑动时渐变的阴影颜色 } else if (checkedId == R.id.rbtn_green) { mDrawer.setScrimColor(getResources().getColor(R.color.color_4bae4f)); } else if (checkedId == R.id.rbtn_blue) { mDrawer.setScrimColor(getResources().getColor(R.color.color_2095f2)); } else if (checkedId == R.id.rbtn_from_left) { mDrawer.openDrawer(Gravity.LEFT); // 打开菜单栏 } else if (checkedId == R.id.rbtn_from_right) { mDrawer.openDrawer(Gravity.RIGHT); } }
private void setupDrawerLayout() { mDrawerLayout = find(R.id.drawer_layout, DrawerLayout.class); mDrawerLayout.setScrimColor(Color.TRANSPARENT); }