question: static int measureChildForCells ( View child , int cellSize , int cellsRemaining , int parentHeightMeasureSpec , int parentHeightPadding ) { final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; final int childHeightSize = MeasureSpec . getSize ( parentHeightMeasureSpec ) - parentHeightPadding ; final int childHeightMode = MeasureSpec . getMode ( parentHeightMeasureSpec ) ; final int childHeightSpec = MeasureSpec . makeMeasureSpec ( childHeightSize , childHeightMode ) ; final ActionMenuItemView itemView = child instanceof ActionMenuItemView ? ( ActionMenuItemView ) child : null ; final boolean hasText = itemView != null && itemView . hasText ( ) ; int cellsUsed = 0 ; if ( cellsRemaining > 0 && ( ! hasText || cellsRemaining >= 2 ) ) { final int childWidthSpec = MeasureSpec . makeMeasureSpec ( cellSize * cellsRemaining , MeasureSpec . AT_MOST ) ; child . measure ( childWidthSpec , childHeightSpec ) ; final int measuredWidth = child . getMeasuredWidth ( ) ; cellsUsed = measuredWidth / cellSize ; if ( measuredWidth % cellSize != 0 ) cellsUsed ++ ; if ( hasText && cellsUsed < 2 ) cellsUsed = 2 ; } final boolean expandable = ! lp . isOverflowButton && hasText ; lp . expandable = expandable ; lp . cellsUsed = cellsUsed ; final int targetWidth = cellsUsed * cellSize ; child . measure ( MeasureSpec . makeMeasureSpec ( targetWidth , MeasureSpec . EXACTLY ) , childHeightSpec ) ; return cellsUsed ; }
target:  Measure a child view to fit within cell-based formatting. The child's width will be measured to a whole multiple of cellSize. <p/> <p>Sets the expandable and cellsUsed fields of LayoutParams.