android.support.v7.widget.CardView.setCardElevation()方法的使用及代码示例

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

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

CardView.setCardElevation介绍

暂无

代码示例

代码示例来源:origin: mancj/MaterialSearchBar

/**
 * Set CardView elevation
 *
 * @param elevation desired elevation
 */
public void setCardViewElevation(int elevation) {
  CardView cardView = findViewById(R.id.mt_container);
  cardView.setCardElevation(elevation);
}

代码示例来源:origin: qs-lll/ExpandingPager

public void close() {
  if (frontAnimator != null) {
    frontAnimator.reverse();
    backAnimator.reverse();
    backAnimator = null;
    frontAnimator = null;
  }
  front.setCardElevation(defaultCardElevation);
}

代码示例来源:origin: lingochamp/okdownload

@Override public void queueEnd(@NonNull DownloadContext context) {
    actionView.setTag(null);
    actionTv.setText(R.string.start);
    // to cancel
    controller.stop();
    serialRb.setEnabled(true);
    parallelRb.setEnabled(true);
    deleteActionView.setEnabled(true);
    deleteActionView.setCardElevation((Float) deleteActionView.getTag());
    deleteActionTv.setEnabled(true);
    adapter.notifyDataSetChanged();
  }
});

代码示例来源:origin: lingochamp/okdownload

@Override public void onClick(View v) {
    final boolean started = v.getTag() != null;
    if (started) {
      controller.stop();
    } else {
      v.setTag(new Object());
      actionTv.setText(R.string.cancel);
      // to start
      controller.start(serialRb.isChecked());
      adapter.notifyDataSetChanged();
      serialRb.setEnabled(false);
      parallelRb.setEnabled(false);
      deleteActionView.setEnabled(false);
      deleteActionView.setTag(deleteActionView.getCardElevation());
      deleteActionView.setCardElevation(0);
      deleteActionTv.setEnabled(false);
    }
  }
});

代码示例来源:origin: qs-lll/ExpandingPager

public void open() {
  ViewGroup.LayoutParams layoutParams = layout3.getLayoutParams();
  layoutParams.height = (int) (front.getHeight() * SCALE_OPENED / 4 * SCALE_OPENED);
  layout3.setLayoutParams(layoutParams);
  ViewCompat.setPivotY(back, 0);
  PropertyValuesHolder front1 = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0, -front.getHeight() / 4);
  PropertyValuesHolder front2 = PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1);
  frontAnimator = ObjectAnimator.ofPropertyValuesHolder(front, front1, front2);
  PropertyValuesHolder backX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1f, 1.2f);
  PropertyValuesHolder backY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1f, 1.2f);
  backAnimator = ObjectAnimator.ofPropertyValuesHolder(back, backX, backY);
  back.setPivotY(0);
  frontAnimator.start();
  backAnimator.start();
  front.setCardElevation(ELEVATION_OPENED);
}

代码示例来源:origin: Ramotion/cardslider-android

card.setCardElevation(Math.max(0, z));

代码示例来源:origin: jrvansuita/MaterialAbout

private void setupCard(AboutBuilder bundle) {
  if (!bundle.isShowAsCard()) {
    cvHolder.setCardElevation(0);
    cvHolder.setRadius(0);
    cvHolder.setUseCompatPadding(false);
    cvHolder.setMaxCardElevation(0);
    cvHolder.setPreventCornerOverlap(false);
    ( (LayoutParams)cvHolder.getLayoutParams()).setMargins(0, 0, 0, 0);
  }
}

代码示例来源:origin: flipkart-incubator/proteus

@Override
 public void setDimension(T view, float dimension) {
  view.setCardElevation(dimension);
 }
});

代码示例来源:origin: florent37/MaterialLeanBack

@Override
  public void onAnimationStart(Animator animation) {
    cardView.setCardElevation(settings.elevationEnlarged);
    currentAnimator = null;
  }
});

代码示例来源:origin: florent37/MaterialLeanBack

@Override
  public void onAnimationStart(Animator animation) {
    cardView.setCardElevation(settings.elevationReduced);
    currentAnimator = null;
  }
});

代码示例来源:origin: henrymorgen/android-advanced-light

@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
  mCardView.setCardElevation(i);
}

代码示例来源:origin: ywwynm/EverythingDone

@Override
  public boolean onTouch(View view, MotionEvent motionEvent) {
    int action = motionEvent.getAction();
    if (action == MotionEvent.ACTION_DOWN) {
      cv.setCardElevation(dp3);
    } else if (action == MotionEvent.ACTION_UP) {
      cv.setCardElevation(dp2);
    }
    return false;
  }
});

代码示例来源:origin: livroandroid/5ed

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if (seekBar == this.seekBar1) {
    cardView.setCardElevation(progress);
  } else if (seekBar == this.seekBar2) {
    cardView.setRadius(progress);
  }
}

代码示例来源:origin: livroandroid/5ed

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if (seekBar == this.seekBar1) {
    cardView.setCardElevation(progress);
  } else if (seekBar == this.seekBar2) {
    cardView.setRadius(progress);
  }
}

代码示例来源:origin: woxblom/DragListView

@Override
public void onBindDragView(View clickedView, View dragView) {
  CharSequence text = ((TextView) clickedView.findViewById(R.id.text)).getText();
  ((TextView) dragView.findViewById(R.id.text)).setText(text);
  CardView dragCard = dragView.findViewById(R.id.card);
  CardView clickedCard = clickedView.findViewById(R.id.card);
  dragCard.setMaxCardElevation(40);
  dragCard.setCardElevation(clickedCard.getCardElevation());
  // I know the dragView is a FrameLayout and that is why I can use setForeground below api level 23
  dragCard.setForeground(clickedView.getResources().getDrawable(R.drawable.card_view_drag_foreground));
}

代码示例来源:origin: shrikanth7698/Custom-Navigation-Drawer

@Override
  public void run() {
    drawerClosed();
    containerCV.setCardElevation((float) 0);
    containerCV.setRadius((float)0);
  }
},500);

代码示例来源:origin: WangDaYeeeeee/Waves

@Override
public void revealFinish() {
  AnimatorSet backgroundIn = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.background_in);
  backgroundIn.setTarget(background);
  Animation viewIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
  cardView.setCardElevation(10);
  infoContainer.setVisibility(View.VISIBLE);
  background.setVisibility(View.VISIBLE);
  backgroundIn.start();
  infoContainer.startAnimation(viewIn);
}

代码示例来源:origin: WangDaYeeeeee/Waves

@Override
public void hide() {
  AnimatorSet backgroundOut = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.background_out);
  backgroundOut.setTarget(background);
  Animation viewOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
  viewOut.setAnimationListener(new viewOutListener());
  cardView.setCardElevation(0);
  backgroundOut.start();
  infoContainer.startAnimation(viewOut);
}

代码示例来源:origin: mylhyl/Android-CircleDialog

protected CardView buildCardView() {
  CardView cardView = new CardView(mContext);
  cardView.setCardElevation(0f);
  cardView.setCardBackgroundColor(Color.TRANSPARENT);
  cardView.setRadius(mParams.dialogParams.radius);
  return cardView;
}

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

@Override
public void addView(View child) {
  if (child instanceof NavigationView) {
    super.addView(child);
  } else {
    CardView cardView = new CardView(getContext());
    cardView.setRadius(0);
    cardView.addView(child);
    cardView.setCardElevation(0);
    frameLayout.addView(cardView);
  }
}

相关文章