private void placeChild(View child,int gravity){
  LayoutParams lp=(LayoutParams)child.getLayoutParams();
  int availableWidth=Math.max(0,mEnd - mStart - lp.startMargin- lp.endMargin);
  if (child.getMeasuredWidth() > availableWidth || gravity == Gravity.FILL_HORIZONTAL) {
    measureChildWithFixedWidth(child,availableWidth);
  }
  if (gravity == Gravity.START || gravity == Gravity.FILL_HORIZONTAL) {
    lp.start=mStart + lp.startMargin;
    mStart=lp.start + child.getMeasuredWidth() + lp.endMargin;
  }
 else {
    lp.start=mEnd - lp.endMargin - child.getMeasuredWidth();
    mEnd=lp.start - lp.startMargin;
  }
  lp.top=mTop + lp.topMargin;
  mBottom=Math.max(mBottom,lp.top + child.getMeasuredHeight() + lp.bottomMargin);
}

private void placeChild ( View child , int gravity ) { LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; int availableWidth = Math . max ( 0 , mEnd - mStart - lp . startMargin - lp . endMargin ) ; if ( child . getMeasuredWidth ( ) > availableWidth || gravity == Gravity . FILL_HORIZONTAL ) { measureChildWithFixedWidth ( child , availableWidth ) ; } if ( gravity == Gravity . START || gravity == Gravity . FILL_HORIZONTAL ) { lp . start = mStart + lp . startMargin ; mStart = lp . start + child . getMeasuredWidth ( ) + lp . endMargin ; } else { lp . start = mEnd - lp . endMargin - child . getMeasuredWidth ( ) ; mEnd = lp . start - lp . startMargin ; } lp . top = mTop + lp . topMargin ; mBottom = Math . max ( mBottom , lp . top + child . getMeasuredHeight ( ) + lp . bottomMargin ) ; }
places a single view on the current row , and updates the view ' s layout parameters to remember its position . mstart , mend , and mbottom are updated to reflect the space taken by the view .
