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

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

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

CardView.onMeasure介绍

暂无

代码示例

代码示例来源:origin: GitLqr/LQRWeChat

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (!isInEditMode()) {
    mHelper.adjustChildren();
  }
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

代码示例来源:origin: xmuSistone/ViewpagerTransition

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    if (ratio > 0) {
      int ratioHeight = (int) (getMeasuredWidth() * ratio);
      setMeasuredDimension(getMeasuredWidth(), ratioHeight);
      ViewGroup.LayoutParams lp = getLayoutParams();
      lp.height = ratioHeight;
      setLayoutParams(lp);
    }
  }
}

代码示例来源:origin: OCNYang/Android-Animation-Set

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

    int width = MeasureSpec.getSize(widthMeasureSpec);
    setMeasuredDimension(width, width);
  }
}

代码示例来源:origin: princeparadoxes/RecyclerBindableAdapter

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, widthMeasureSpec);
  }
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // Set a square layout.
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    int measureSpec = width < height ? widthMeasureSpec : heightMeasureSpec;
    super.onMeasure(measureSpec, measureSpec);
  }
}

代码示例来源:origin: RealMoMo/Study_Android_Demo

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);

    int width = MeasureSpec.getSize(widthMeasureSpec);
    setMeasuredDimension(width, width);
  }
}

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

@Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    setRadius((float) (getMeasuredHeight() * 0.5));
  }
}

代码示例来源:origin: noterpopo/Hands-Chopping

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
  if (!isInEditMode())
  {
    mHelper.adjustChildren();
  }
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

代码示例来源:origin: envyfan/AndroidReview

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec));
  // Children are just made to fill our space.
  int childWidthSize = getMeasuredWidth();
  int childHeightSize = getMeasuredHeight();
  //高度和宽度一样
  widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY);
  heightMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize/4*3, MeasureSpec.EXACTLY);
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

相关文章