code: private void setUpChild(View child) {
  
          // Respect layout params that are already in the view. Otherwise
          // make some up...
          ViewGroup.LayoutParams lp = child.getLayoutParams();
          if (lp == null) {
              lp = generateDefaultLayoutParams();
          }
  
          addViewInLayout(child, 0, lp);
  
          child.setSelected(hasFocus());
          if (mDisableChildrenWhenDisabled) {
              child.setEnabled(isEnabled());
          }
  
          // Get measure specs
          int childHeightSpec = ViewGroup.getChildMeasureSpec(mHeightMeasureSpec,
                  mSpinnerPadding.top + mSpinnerPadding.bottom, lp.height);
          int childWidthSpec = ViewGroup.getChildMeasureSpec(mWidthMeasureSpec,
                  mSpinnerPadding.left + mSpinnerPadding.right, lp.width);
  
          // Measure child
          child.measure(childWidthSpec, childHeightSpec);
  
          int childLeft;
          int childRight;
  
          // Position vertically based on gravity setting
          int childTop = mSpinnerPadding.top
                  + ((getMeasuredHeight() - mSpinnerPadding.bottom -
                          mSpinnerPadding.top - child.getMeasuredHeight()) / 2);
          int childBottom = childTop + child.getMeasuredHeight();
  
          int width = child.getMeasuredWidth();
          childLeft = 0;
          childRight = childLeft + width;
  
          child.layout(childLeft, childTop, childRight, childBottom);
      }
docs: Helper for makeAndAddView to set the position of a view
  and fill out its layout paramters.
  
  @param child The view to position