Пример #1
0
  private void measureScrapChild(View child, int position, int widthMeasureSpec) {
    ListView.LayoutParams p = (ListView.LayoutParams) child.getLayoutParams();
    if (p == null) {
      p =
          new ListView.LayoutParams(
              ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);
      child.setLayoutParams(p);
    }
    // XXX p.viewType = mAdapter.getItemViewType(position);
    // XXX p.forceAdd = true;

    int childWidthSpec =
        ViewGroup.getChildMeasureSpec(
            widthMeasureSpec,
            mDropDownList.getPaddingLeft() + mDropDownList.getPaddingRight(),
            p.width);
    int lpHeight = p.height;
    int childHeightSpec;
    if (lpHeight > 0) {
      childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
    } else {
      childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    }
    child.measure(childWidthSpec, childHeightSpec);
  }