2013-07-23 27 views
0

在下面的示例代碼中,我找到heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize,MeasureSpec.EXACTLY)。 代碼中有兩個「=」,是不是?這是Java語法嗎?heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(childWidthSize,MeasureSpec.EXACTLY)是什麼意思?

@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); 
    } 

回答

4

是的,它允許在Java中使用。它將heightMeasureSpecwidthMeasureSpec都設置爲從MeasureSpec.makeMeasureSpec(childWidthSize, MeasureSpec.EXACTLY)返回的值。