本文整理汇总了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;
}