在下面的示例代码中,我找到heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize,MeasureSpec.EXACTLY)。 代码中有两个“=”,是不是?这是Java语法吗?
@SuppressWarnings("unused")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(getDefaultSize(0, widthMeasureSpec), getDefaultSize(0, heightMeasureSpec));
int childWidthSize = getMeasuredWidth();
int childHeightSize = getMeasuredHeight();
heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
答案 0 :(得分:4)
是的,它在Java中是允许的。它将heightMeasureSpec
和widthMeasureSpec
设置为MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY)
返回的值。