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

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

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

CardView.getLayoutParams介绍

暂无

代码示例

代码示例来源:origin: jdsjlzx/LRecyclerView

@Override
public void onBindItemHolder(SuperViewHolder holder, int position) {
  CardView cardView =  holder.getView(R.id.card_view);
  TextView textView = holder.getView(R.id.info_text);
  ItemModel itemModel = mDataList.get(position);
  textView.setText(itemModel.title);
  //修改高度,模拟交错效果
  cardView.getLayoutParams().height = itemModel.height;
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

break;
case TYPE_ACTIVITY:
  ViewGroup.LayoutParams layoutParams = itemViewHolder.mCardView.getLayoutParams();
  layoutParams.height = DisplayUtil.dp2px(mContext, 200f);
  itemViewHolder.mCardView.setLayoutParams(layoutParams);

代码示例来源:origin: arimorty/floatingsearchview

R.styleable.FloatingSearchView_floatingSearch_searchBarWidth,
    ViewGroup.LayoutParams.MATCH_PARENT);
mQuerySection.getLayoutParams().width = searchBarWidth;
mDivider.getLayoutParams().width = searchBarWidth;
mSuggestionListContainer.getLayoutParams().width = searchBarWidth;
    R.styleable.FloatingSearchView_floatingSearch_searchBarMarginRight,
    ATTRS_SEARCH_BAR_MARGIN_DEFAULT);
LayoutParams querySectionLP = (LayoutParams) mQuerySection.getLayoutParams();
LayoutParams dividerLP = (LayoutParams) mDivider.getLayoutParams();
LinearLayout.LayoutParams 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: 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: 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();
    loginButton.setVisibility(View.GONE);
  }
});

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

@Override
public void onEasingValueChanged(double value, double oldValue) {
  int diff_margin = curr_singup_margin - target_singup_margin;
  int margin = target_singup_margin + (int) (diff_margin - (diff_margin * value));
  LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) singupButton.getLayoutParams();
  layoutParams.setMargins(0, 0, margin, 0);
  singupButton.requestLayout();
  diff_margin = curr_login_margin - target_login_margin;
  margin = target_login_margin + (int) (diff_margin - (diff_margin * value));
  layoutParams = (LinearLayout.LayoutParams) loginButton.getLayoutParams();
  layoutParams.leftMargin = margin;
  loginButton.requestLayout();
}

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

@Override
public void onEasingStarted(double value) {
  int diff_margin = curr_singup_margin - target_singup_margin;
  int margin = target_singup_margin + (int) (diff_margin - (diff_margin * value));
  LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) singupButton.getLayoutParams();
  layoutParams.setMargins(0, 0, margin, 0);
  singupButton.requestLayout();
  diff_margin = curr_login_margin - target_login_margin;
  margin = target_login_margin + (int) (diff_margin - (diff_margin * value));
  layoutParams = (LinearLayout.LayoutParams) loginButton.getLayoutParams();
  layoutParams.setMargins(margin, 0, 0, 0);
  loginButton.requestLayout();
}

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

@Override
public void onEasingValueChanged(double value, double oldValue) {
  int diff_margin = curr_singup_margin - target_singup_margin;
  int margin = target_singup_margin + (int) (diff_margin - (diff_margin * value));
  LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) singupButton.getLayoutParams();
  layoutParams.setMargins(0, 0, margin, 0);
  singupButton.requestLayout();
  diff_margin = curr_login_margin - target_login_margin;
  margin = target_login_margin + (int) (diff_margin - (diff_margin * value));
  layoutParams = (LinearLayout.LayoutParams) loginButton.getLayoutParams();
  layoutParams.leftMargin = margin;
  loginButton.requestLayout();
}

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

@Override
public void onEasingStarted(double value) {
  int diff_margin = curr_singup_margin - target_singup_margin;
  int margin = target_singup_margin + (int) (diff_margin - (diff_margin * value));
  LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) singupButton.getLayoutParams();
  layoutParams.setMargins(0, 0, margin, 0);
  singupButton.requestLayout();
  diff_margin = curr_login_margin - target_login_margin;
  margin = target_login_margin + (int) (diff_margin - (diff_margin * value));
  layoutParams = (LinearLayout.LayoutParams) loginButton.getLayoutParams();
  layoutParams.setMargins(margin, 0, 0, 0);
  loginButton.requestLayout();
}

代码示例来源: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: Nipuream/NRecyclerView

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
  if(isStaggered)
    holder.cardView.getLayoutParams().height = position % 2 != 0 ? largeCardHeight : smallCardHeight;
  SampleApp.instance.getmImageLoader().get(images.get(position),holder.iv);
}

代码示例来源:origin: james602152002/FloatingLabelSpinner

public void setAdapter(FloatingLabelSpinner spinner, HintAdapter hintAdapter, short margin, AdapterView.OnItemSelectedListener listener) {
  this.spinner = spinner;
  View contentView = LayoutInflater.from(spinner.getContext()).inflate(R.layout.floating_label_spinner_popup_window, null, false);
  ListView listView = contentView.findViewById(R.id.list_view);
  CardView cardView = contentView.findViewById(R.id.card_view);
  dropDownViewAdapter = new DropDownViewAdapter(hintAdapter);
  listView.setAdapter(dropDownViewAdapter);
  ((FrameLayout.LayoutParams) cardView.getLayoutParams()).setMargins(margin, margin, margin, margin);
  setContentView(contentView);
  this.listener = listener;
  listView.setOnItemClickListener(this);
}

代码示例来源: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: WangDaYeeeeee/Mysplash

this.collection = collection;
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) card.getLayoutParams();
if (columnCount > 1) {
  int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);

代码示例来源: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: ypicoleal/LoginDemo

int margin = circle_target_margin + (int) (diff_margin - (diff_margin * interpolatedTime));
RelativeLayout.LayoutParams params_circle = (RelativeLayout.LayoutParams) animationCircle.getLayoutParams();
params_circle.setMargins(0, 0, margin, (int) (40 * scale + 0.5f));
animationCircle.requestLayout();

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

this.collection = collection;
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) card.getLayoutParams();
if (columnCount > 1) {
  int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);

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

ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) card.getLayoutParams();
int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);
if (columnCount > 1) {

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

void onBindView(final int position) {
  this.photo = itemList.get(position);
  ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) card.getLayoutParams();
  if (columnCount > 1) {
    int margin = a.getResources().getDimensionPixelSize(R.dimen.normal_margin);

相关文章