android.support.v4.widget.DrawerLayout.setDrawerElevation()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中android.support.v4.widget.DrawerLayout.setDrawerElevation()方法的一些代码示例,展示了DrawerLayout.setDrawerElevation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DrawerLayout.setDrawerElevation()方法的具体详情如下:
包路径:android.support.v4.widget.DrawerLayout
类名称:DrawerLayout
方法名:setDrawerElevation

DrawerLayout.setDrawerElevation介绍

暂无

代码示例

代码示例来源:origin: shiburagi/Drawer-Behavior

@Override
public void setDrawerElevation(float elevation) {
  defaultDrawerElevation = elevation;
  super.setDrawerElevation(elevation);
}

代码示例来源:origin: AriesHoo/UIWidget

@Override
  protected void initView(Bundle bundle) {
    drawerRoot.setScrimColor(Color.argb(30, 0, 0, 0));//背景高亮
    drawerRoot.setDrawerElevation(40);//海拔高度
//        mContentView.setBackgroundDrawable(null);
    GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead);
    titleBarDrawer.setImmersible(mContext, isImmersible, isLight);
    vHeader = View.inflate(mContext, R.layout.layout_title_header, null);
    sBtnImmersible = vHeader.findViewById(R.id.sBtn_immersible);
    sBtnLight = vHeader.findViewById(R.id.sBtn_light);
    sBtnLine = vHeader.findViewById(R.id.sBtn_line);
    lLayoutAlpha = vHeader.findViewById(R.id.lLayout_alpha);
    sBarAlpha = vHeader.findViewById(R.id.sBar_alpha);
    tvStatusAlpha = vHeader.findViewById(R.id.tv_statusAlpha);
    initView();
    setDrawerList();
    initData();
  }

代码示例来源:origin: shiburagi/Drawer-Behavior

private void updateSlideOffset(View drawerView, float slideOffset) {
  final int absHorizGravity = getDrawerViewAbsoluteGravity(Gravity.START);
  final int childAbsGravity = getDrawerViewAbsoluteGravity(drawerView);
  for (int i = 0; i < frameLayout.getChildCount(); i++) {
    CardView child = (CardView) frameLayout.getChildAt(i);
    Setting setting = settings.get(childAbsGravity);
    float adjust = 0;
    if (setting != null) {
      child.setRadius((int) (setting.radius * slideOffset));
      super.setScrimColor(setting.scrimColor);
      super.setDrawerElevation(setting.drawerElevation);
      float percentage = 1f - setting.percentage;
      ViewCompat.setScaleY(child, 1f - percentage * slideOffset);
      child.setCardElevation(setting.elevation * slideOffset);
      adjust = setting.elevation;
      boolean isLeftDrawer = childAbsGravity == absHorizGravity;
      float width = isLeftDrawer ?
          drawerView.getWidth() + adjust : -drawerView.getWidth() - adjust;
      updateSlideOffset(child, setting, width, slideOffset, isLeftDrawer);
    } else {
      super.setScrimColor(defaultScrimColor);
      super.setDrawerElevation(defaultDrawerElevation);
    }
  }
}

相关文章