本文整理了Java中android.support.v7.widget.CardView
类的一些代码示例,展示了CardView
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CardView
类的具体详情如下:
包路径:android.support.v7.widget.CardView
类名称:CardView
暂无
代码示例来源:origin: lingochamp/okdownload
final AppCompatRadioButton parallelRb,
final CardView deleteActionView, final View deleteActionTv) {
deleteActionView.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
controller.deleteFiles();
代码示例来源:origin: arimorty/floatingsearchview
/**
* Sets the background color of the search
* view including the suggestions section.
*
* @param color the color to be applied to the search bar and
* the suggestion section background.
*/
public void setBackgroundColor(int color) {
mBackgroundColor = color;
if (mQuerySection != null && mSuggestionsList != null) {
mQuerySection.setCardBackgroundColor(color);
mSuggestionsList.setBackgroundColor(color);
}
}
代码示例来源:origin: fanrunqi/MaterialLogin
@Override
public void onTransitionStart(Transition transition) {
cvAdd.setVisibility(View.GONE);
}
代码示例来源:origin: arimorty/floatingsearchview
private int actionMenuAvailWidth() {
if (isInEditMode()) {
return mQuerySection.getMeasuredWidth() / 2;
}
return mQuerySection.getWidth() / 2;
}
代码示例来源: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: 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: HotBitmapGG/bilibili-android-client
itemViewHolder.mCardView.setOnClickListener(v -> {
String gotoX = bodyBean.getGotoX();
switch (gotoX) {
break;
case TYPE_ACTIVITY:
ViewGroup.LayoutParams layoutParams = itemViewHolder.mCardView.getLayoutParams();
layoutParams.height = DisplayUtil.dp2px(mContext, 200f);
itemViewHolder.mCardView.setLayoutParams(layoutParams);
itemViewHolder.mLiveLayout.setVisibility(View.GONE);
itemViewHolder.mVideoLayout.setVisibility(View.GONE);
代码示例来源: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: freedom10086/Ruisi
private void showSearchView() {
searchCard.setVisibility(View.VISIBLE);
animator = ViewAnimationUtils.createCircularReveal(
searchCard,
searchCard.getWidth(),
0,
0,
(float) Math.hypot(searchCard.getWidth(), searchCard.getHeight()));
animator.setInterpolator(new AccelerateInterpolator());
animator.setDuration(260);
animator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
KeyboardUtil.showKeyboard(searchInput);
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
animator.start();
}
代码示例来源:origin: fanrunqi/MaterialLogin
public void animateRevealShow() {
Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth()/2,0, fab.getWidth() / 2, cvAdd.getHeight());
mAnimator.setDuration(500);
mAnimator.setInterpolator(new AccelerateInterpolator());
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
}
@Override
public void onAnimationStart(Animator animation) {
cvAdd.setVisibility(View.VISIBLE);
super.onAnimationStart(animation);
}
});
mAnimator.start();
}
代码示例来源: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: 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: 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: 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: 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: ypicoleal/LoginDemo
@Override
public void onEasingFinished(double value) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) singupButton.getLayoutParams();
layoutParams.setMargins(0, 0, target_singup_margin, 0);
singupButton.requestLayout();
layoutParams = (LinearLayout.LayoutParams) loginButton.getLayoutParams();
layoutParams.setMargins(target_login_margin, 0, 0, 0);
loginButton.requestLayout();
singupButton.setVisibility(View.GONE);
}
});
代码示例来源:origin: ywwynm/EverythingDone
private void distinguishHeaderAndOthers(boolean header, CardView cv) {
int mX = (int) (mDensity * 4);
if (DeviceUtil.hasLollipopApi()) {
mX = (int) (mDensity * 6);
}
int mY = header ? 0 : mX;
int height;
if (header) {
height = (int) (App.isSearching ? mDensity * 6 : mDensity * 102);
} else {
height = StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT;
}
cv.setVisibility(header ? View.INVISIBLE : View.VISIBLE);
StaggeredGridLayoutManager.LayoutParams lp =
(StaggeredGridLayoutManager.LayoutParams) cv.getLayoutParams();
lp.height = height;
lp.setMargins(mX, mY, mX, mY);
lp.setFullSpan(header);
}
代码示例来源: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: NightscoutFoundation/xDrip
private synchronized void showSnoozeFloater() {
if (floaterHidden) {
animateSnoozeFloater(floatingsnooze.getHeight(), 0, new DecelerateInterpolator(1.5f));
floaterHidden = false;
floatingsnooze.setVisibility(View.VISIBLE);
showcase(this, SHOWCASE_REMINDER3);
}
hideKeyboard(recyclerView);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!