Java Code Examples for android.view.View.forceLayout()

The following are Jave code examples for showing how to use forceLayout() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: RLibrary   File: UILayoutImpl.java   Source Code and License Vote up 6 votes
/**
 * 清除已经布局的flag
 */
public void setIViewNeedLayout(View view, boolean layout) {
    view.setTag(R.id.tag_need_layout, layout ? "true" : "false");
    if (layout) {
        view.forceLayout();
    }
}
 
Example 2
Project: andswipeframework   File: DraggingProxy.java   Source Code and License Vote up 5 votes
public void requestLayout() {
    for (View dragView : mSwipeViewLayouter.getViews().values()) {
        dragView.forceLayout();
    }
}
 
Example 3
Project: boohee_v5.6   File: ListViewCompat.java   Source Code and License Vote up 5 votes
public int measureHeightOfChildrenCompat(int widthMeasureSpec, int startPosition, int endPosition, int maxHeight, int disallowPartialChildPosition) {
    int paddingTop = getListPaddingTop();
    int paddingBottom = getListPaddingBottom();
    int paddingLeft = getListPaddingLeft();
    int paddingRight = getListPaddingRight();
    int reportedDividerHeight = getDividerHeight();
    Drawable divider = getDivider();
    ListAdapter adapter = getAdapter();
    if (adapter == null) {
        return paddingTop + paddingBottom;
    }
    int returnedHeight = paddingTop + paddingBottom;
    int dividerHeight = (reportedDividerHeight <= 0 || divider == null) ? 0 : reportedDividerHeight;
    int prevHeightWithoutPartialChild = 0;
    View child = null;
    int viewType = 0;
    int count = adapter.getCount();
    int i = 0;
    while (i < count) {
        int heightMeasureSpec;
        int newType = adapter.getItemViewType(i);
        if (newType != viewType) {
            child = null;
            viewType = newType;
        }
        child = adapter.getView(i, child, this);
        LayoutParams childLp = child.getLayoutParams();
        if (childLp == null) {
            childLp = generateDefaultLayoutParams();
            child.setLayoutParams(childLp);
        }
        if (childLp.height > 0) {
            heightMeasureSpec = MeasureSpec.makeMeasureSpec(childLp.height, 1073741824);
        } else {
            heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, 0);
        }
        child.measure(widthMeasureSpec, heightMeasureSpec);
        child.forceLayout();
        if (i > 0) {
            returnedHeight += dividerHeight;
        }
        returnedHeight += child.getMeasuredHeight();
        if (returnedHeight < maxHeight) {
            if (disallowPartialChildPosition >= 0 && i >= disallowPartialChildPosition) {
                prevHeightWithoutPartialChild = returnedHeight;
            }
            i++;
        } else if (disallowPartialChildPosition < 0 || i <= disallowPartialChildPosition || prevHeightWithoutPartialChild <= 0 || returnedHeight == maxHeight) {
            return maxHeight;
        } else {
            return prevHeightWithoutPartialChild;
        }
    }
    return returnedHeight;
}