本文整理了Java中android.widget.Button.onMeasure()
方法的一些代码示例,展示了Button.onMeasure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.onMeasure()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:onMeasure
暂无
代码示例来源:origin: ZieIony/Carbon
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getMeasuredWidth() > maxWidth || getMeasuredHeight() > maxHeight) {
if (getMeasuredWidth() > maxWidth)
widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.EXACTLY);
if (getMeasuredHeight() > maxHeight)
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
代码示例来源:origin: lygttpod/AndroidCustomView
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
mWidth = width;
mHeight = height;
centerX = mWidth / 2;
centerY = mHeight / 2;
radius = mHeight / 8;
Log.d("allen", "onMeasure: " + centerX);
}
代码示例来源:origin: derry/delion
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int desiredWidth = Math.max(
mIncognitoDrawable.getIntrinsicWidth(), mNormalDrawable.getIntrinsicWidth());
desiredWidth += getPaddingLeft() + getPaddingRight();
widthMeasureSpec = MeasureSpec.makeMeasureSpec(desiredWidth, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
代码示例来源:origin: jiang111/CProgressButton
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = getWidth() - getPaddingLeft() - getPaddingRight();
mHeight = getHeight() - getPaddingTop() - getPaddingRight();
}
内容来源于网络,如有侵权,请联系作者删除!