本文整理匯總了Java中android.view.View.forceLayout方法的典型用法代碼示例。如果您正苦於以下問題:Java View.forceLayout方法的具體用法?Java View.forceLayout怎麽用?Java View.forceLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.View
的用法示例。
在下文中一共展示了View.forceLayout方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setIViewNeedLayout
import android.view.View; //導入方法依賴的package包/類
/**
* 清除已經布局的flag
*/
public void setIViewNeedLayout(View view, boolean layout) {
view.setTag(R.id.tag_need_layout, layout ? "true" : "false");
if (layout) {
view.forceLayout();
}
}
示例2: requestLayout
import android.view.View; //導入方法依賴的package包/類
public void requestLayout() {
for (View dragView : mSwipeViewLayouter.getViews().values()) {
dragView.forceLayout();
}
}
示例3: measureHeightOfChildrenCompat
import android.view.View; //導入方法依賴的package包/類
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;
}