Code example for View

Methods: getLayoutParams, measure, setLayoutParams

0
        // At this point, we went through the range of children, and they each 
        // completely fit, so return the returnedHeight 
        return returnedHeight;
    } 
    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);
    } 
 
    private static class DropDownListView extends ListView {
        /* 
         * WARNING: This is a workaround for a touch mode issue.