code: private void obtainToolbarElevation() {
          int elevation;
  
          try {
              elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.toolbarElevation);
          } catch (NotFoundException e) {
              elevation = getResources().getDimensionPixelSize(R.dimen.toolbar_elevation);
          }
  
          setToolbarElevation(pixelsToDp(this, elevation));
      }
docs: Obtains the elevation of the activity's toolbar from the activity's theme.