question: @ Override protected void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { int count = getChildCount ( ) ; if ( count != 2 ) throw new IllegalStateException ( "SlidingDrawer must have exactly 2 children." ) ; initSlidingChild ( ) ; int maxHeight = 0 ; int maxWidth = 0 ; int childState = 0 ; for ( int i = 0 ; i < count ; i ++ ) { final View child = getChildAt ( i ) ; if ( child . getVisibility ( ) == GONE ) continue ; measureChildWithMargins ( child , widthMeasureSpec , 0 , heightMeasureSpec , 0 ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; maxWidth = Math . max ( maxWidth , child . getMeasuredWidth ( ) + lp . leftMargin + lp . rightMargin ) ; maxHeight = Math . max ( maxHeight , child . getMeasuredHeight ( ) + lp . topMargin + lp . bottomMargin ) ; childState = combineMeasuredStates ( childState , child . getMeasuredState ( ) ) ; } maxHeight = Math . max ( maxHeight , getSuggestedMinimumHeight ( ) ) ; maxWidth = Math . max ( maxWidth , getSuggestedMinimumWidth ( ) ) ; setMeasuredDimension ( resolveSizeAndState ( maxWidth , widthMeasureSpec , childState ) , resolveSizeAndState ( maxHeight , heightMeasureSpec , childState << MEASURED_HEIGHT_STATE_SHIFT ) ) ; }
target:  Ask all children to measure themselves and compute the measurement of this layout based on the children.