本文整理了Java中android.support.v7.widget.CardView.setLayoutParams()
方法的一些代码示例,展示了CardView.setLayoutParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CardView.setLayoutParams()
方法的具体详情如下:
包路径:android.support.v7.widget.CardView
类名称:CardView
方法名:setLayoutParams
暂无
代码示例来源:origin: HotBitmapGG/bilibili-android-client
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: arimorty/floatingsearchview
((MarginLayoutParams) mDivider.getLayoutParams()).bottomMargin);
suggestListSectionLP.setMargins(searchBarLeftMargin, 0, searchBarRightMargin, 0);
mQuerySection.setLayoutParams(querySectionLP);
mDivider.setLayoutParams(dividerLP);
mSuggestionsSection.setLayoutParams(suggestListSectionLP);
代码示例来源: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: Werb/GankWithZhihu
public Feed_1_ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ScreenUtil screenUtil = ScreenUtil.instance(context);
card_feed_1.setLayoutParams(new LinearLayout.LayoutParams(screenUtil.getScreenWidth(), ViewGroup.LayoutParams.WRAP_CONTENT));
}
代码示例来源:origin: Werb/GankWithZhihu
public StoriesViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ScreenUtil screenUtil = ScreenUtil.instance(context);
int screenWidth = screenUtil.getScreenWidth();
card_stories.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, LinearLayout.LayoutParams.WRAP_CONTENT));
}
代码示例来源:origin: Werb/GankWithZhihu
public Feed_0_ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ScreenUtil screenUtil = ScreenUtil.instance(context);
card_layout.setLayoutParams(new LinearLayout.LayoutParams(screenUtil.getScreenWidth(), ViewGroup.LayoutParams.WRAP_CONTENT));
}
代码示例来源:origin: ApplikeySolutions/OrionPreview
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
llProductDetails.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
llProductDetails.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) cvProductDetails.getLayoutParams();
params.bottomMargin = llProductDetails.getMeasuredHeight() * -1;
cvProductDetails.setLayoutParams(params);
}
});
代码示例来源: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: WangDaYeeeeee/Mysplash
int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);
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: anyaudio/anyaudio-android-app
FrameLayout.LayoutParams thumbnailParams = new FrameLayout.LayoutParams(widthPx,thumbnailHeight);
songCard.setLayoutParams(new RelativeLayout.LayoutParams(widthPx, ViewGroup.LayoutParams.WRAP_CONTENT));
代码示例来源:origin: mylhyl/Android-CircleDialog
cardView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1));
mItemsView = new BodyRecyclerView(mContext, popupParams, dialogParams);
final View recyclerView = mItemsView.getView();
代码示例来源:origin: WeDevelopTeam/HeroVideo-master
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: WangDaYeeeeee/Mysplash
int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);
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: WangDaYeeeeee/Mysplash
int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);
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: WangDaYeeeeee/Mysplash
params.setMarginEnd(margin);
params.setMargins(0, 0, margin, margin);
card.setLayoutParams(params);
} else {
params.setMargins(
a.getResources().getDimensionPixelSize(R.dimen.large_icon_size), 0, margin, margin);
card.setLayoutParams(params);
代码示例来源:origin: OhMyLob/Paper-Launcher
+ DpPxUtil.dpToPx(this, 8) * slideOffset);
mSearchBarCardView.setLayoutParams(searchBarCardViewLayoutParams);
代码示例来源:origin: vinsol-spree-contrib/spree-android
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
ViewMode viewMode = ViewMode.values()[getItemViewType(position)];
Product product = products.get(position);
switch (viewMode) {
case LIST: ((ProductsListItemViewHolder) holder).setup(context, product);
break;
case GRID: int margin = Common.convertDpToPixel(context, 5);
int imageDimension = (DisplayArea.getDisplayWidth() - Common.convertDpToPixel(context, 15))/2;
GridLayoutManager.LayoutParams params = new GridLayoutManager.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(margin, margin, margin, 0);
if (position%2==0) {
// Left Item
params.rightMargin = Common.convertDpToPixel(context, 2.5f);
}
else {
// Right Item
params.leftMargin = Common.convertDpToPixel(context, 2.5f);
}
((ProductsGridItemViewHolder) holder).getCardView().setLayoutParams(params);
RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
imageParams.width = imageDimension;
imageParams.height = imageDimension;
((ProductsGridItemViewHolder) holder).getImg().setLayoutParams(imageParams);
((ProductsGridItemViewHolder) holder).setup(context, product);
break;
case CARD: ((ProductsCardItemViewHolder) holder).setup(context, product);
break;
}
}
代码示例来源:origin: WangDaYeeeeee/Mysplash
params.setMarginStart(marginHorizontal);
params.setMarginEnd(marginHorizontal);
cardBackground.setLayoutParams(params);
内容来源于网络,如有侵权,请联系作者删除!