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

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

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

CardView.setRadius介绍

暂无

代码示例

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

/**
 * Capsule shaped searchbar enabled
 * Only works on SDK V21+ due to odd behavior on lower
 */
private void setupRoundedSearchBarEnabled() {
  if (roundedSearchBarEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    searchBarCardView.setRadius(getResources().getDimension(R.dimen.corner_radius_rounded));
  } else {
    searchBarCardView.setRadius(getResources().getDimension(R.dimen.corner_radius_default));
  }
}

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

private void addCardCorners() {
  final CardView cardView = (CardView) findViewById(R.id.card);
  cardView.setRadius(25f);
}

代码示例来源: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.setRadius(dimension);
 }
});

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

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

代码示例来源:origin: googlesamples/android-CardView

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  Log.d(TAG, String.format("SeekBar Radius progress : %d", progress));
  mCardView.setRadius(progress);
}
@Override

代码示例来源:origin: ypicoleal/LoginDemo

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  int diff_radius = first_curr_radius - first_target_radius;
  int radius = first_target_radius + (int) (diff_radius - (diff_radius * interpolatedTime));
  first_container.setRadius(radius);
  first_container.requestLayout();
  diff_radius = second_curr_radius - second_target_radius;
  radius = second_target_radius + (int) (diff_radius - (diff_radius * interpolatedTime));
  second_container.setRadius(radius);
  second_container.requestLayout();
}

代码示例来源:origin: ypicoleal/LoginDemo

@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
  int diff_radius = first_curr_radius - first_target_radius;
  int radius = first_target_radius + (int) (diff_radius - (diff_radius * interpolatedTime));
  first_container.setRadius(radius);
  first_container.requestLayout();
  diff_radius = second_curr_radius - second_target_radius;
  radius = second_target_radius + (int) (diff_radius - (diff_radius * interpolatedTime));
  second_container.setRadius(radius);
  second_container.requestLayout();
}

代码示例来源: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: shrikanth7698/Custom-Navigation-Drawer

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

代码示例来源:origin: KingsMentor/Rationale

private void styleUI(View view) {
  TypedArray ta = getContext().obtainStyledAttributes(getStyleRes(), attrs);
  int primary_color = ta.getColor(0, ContextCompat.getColor(getContext(), R.color.primary_color));
  int secondary_color = ta.getColor(1, ContextCompat.getColor(getContext(), R.color.secondary_color));
  boolean showRationaleState = ta.getBoolean(2, true);
  rationaleColorDeny = ta.getColor(3, ContextCompat.getColor(getContext(), R.color.deny_state));
  rationaleColorIgnore = ta.getColor(4, ContextCompat.getColor(getContext(), R.color.ignore_state));
  rationaleTextColorDeny = ta.getColor(5, ContextCompat.getColor(getContext(), R.color.grey));
  rationaleTextColorIgnore = ta.getColor(6, ContextCompat.getColor(getContext(), R.color.ignore_state));
  rationaleTextSize = ta.getDimension(7, getResources().getDimension(R.dimen.rationale_text_size));
  float card_corner = ta.getDimension(8, getResources().getDimension(R.dimen.card_corner));
  rationaleTextFont = ta.getString(9);
  rationaleTextFont = rationaleTextFont == null ? getResources().getString(R.string.rationale_font) : rationaleTextFont.isEmpty() ? getResources().getString(R.string.rationale_font) : rationaleTextFont;
  ((CardView) view.findViewById(R.id.dialog_card)).setRadius(card_corner);
  view.findViewById(R.id.permission_state).setVisibility(showRationaleState ? View.VISIBLE : View.GONE);
  view.findViewById(R.id.primary).setBackgroundColor(primary_color);
  view.findViewById(R.id.secondary).setBackgroundColor(secondary_color);
  ((AppCompatButton) view.findViewById(R.id.permission_no)).setTextColor(primary_color);
  ((AppCompatButton) view.findViewById(R.id.permission_yes)).setTextColor(primary_color);
}

代码示例来源: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: mylhyl/Android-CircleDialog

@Override
protected void buildRootView() {
  LinearLayout rootItem = new LinearLayout(mContext);
  rootItem.setOrientation(LinearLayout.VERTICAL);
  CardView cardView = new CardView(mContext);
  cardView.setCardElevation(0f);
  cardView.setCardBackgroundColor(Color.TRANSPARENT);
  cardView.setRadius(mParams.dialogParams.radius);
  LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
  //设置列表与按钮之间的下距离
  layoutParams.bottomMargin = mParams.itemsParams.bottomMargin;
  cardView.setLayoutParams(layoutParams);
  rootItem.addView(cardView);
  LinearLayout rootCardViewByLinearLayout = buildLinearLayout();
  cardView.addView(rootCardViewByLinearLayout);
  mRoot = rootItem;
}

代码示例来源: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);
  }
}

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

params.setMargins(0, 0, margin, margin);
  card.setLayoutParams(params);
  card.setRadius(a.getResources().getDimensionPixelSize(R.dimen.material_card_radius));
} else {
  params.setMargins(0, 0, 0, 0);
  card.setLayoutParams(params);
  card.setRadius(0);

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

public void openDrawer(){
  drawerOpening();
  navOpen=true;
  final int[] stateSet = {android.R.attr.state_checked * (navOpen ? 1 : -1)};
  menuIV.setImageState(stateSet,true);
  containerCV.setCardElevation((float) 100.0);
  containerCV.setRadius((float)60.0);
  appbarTitleTV.animate().translationX(centerX+menuIV.getWidth()+menuIV.getWidth()/4+appbarTitleTV.getWidth()/2-appbarRL.getWidth()/2).start();
  containerCV.animate().translationX(rootLayout.getX() +(rootLayout.getWidth() / 8)+ (rootLayout.getWidth() / 2) ).translationY(250).setDuration(500).start();
  final Handler handler = new Handler();
  handler.postDelayed(new Runnable() {
    @Override
    public void run() {
      drawerOpened();
    }
  },250);
}

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

params.setMargins(0, 0, margin, margin);
  card.setLayoutParams(params);
  card.setRadius(a.getResources().getDimensionPixelSize(R.dimen.material_card_radius));
} else {
  params.setMargins(0, 0, 0, 0);
  card.setLayoutParams(params);
  card.setRadius(0);

代码示例来源: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);
    }
  }
}

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

params.setMargins(0, 0, margin, margin);
  card.setLayoutParams(params);
  card.setRadius(a.getResources().getDimensionPixelSize(R.dimen.material_card_radius));
} else {
  params.setMargins(0, 0, 0, 0);
  card.setLayoutParams(params);
  card.setRadius(0);

相关文章