本文整理汇总了Java中android.view.View.getMeasuredState方法的典型用法代码示例。如果您正苦于以下问题:Java View.getMeasuredState方法的具体用法?Java View.getMeasuredState怎么用?Java View.getMeasuredState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getMeasuredState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: measureExtraView
import android.view.View; //导入方法依赖的package包/类
protected int measureExtraView(View view, int widthMeasureSpec, int heightMeasureSpec, boolean horizontal) {
int childState = 0;
if (isChildNotGone(view)) {
int mContentWidth = getContentWidth(), mContentHeight = getContentHeight();
PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) view.getLayoutParams();
int childMarginHorizontal = params.getMarginHorizontal();
int childMarginVertical = params.getMarginVertical();
int extraMeasureWidthSpec = getChildMeasureSpec(widthMeasureSpec, childMarginHorizontal, params.width);
int extraMeasureHeightSpec = getChildMeasureSpec(heightMeasureSpec, childMarginVertical, params.height);
if (horizontal) {
if (params.width == -1) {
extraMeasureWidthSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(extraMeasureWidthSpec), MeasureSpec.EXACTLY);
}
params.measure(view, extraMeasureWidthSpec, extraMeasureHeightSpec);
int contentHeight = view.getMeasuredHeight() + childMarginVertical;
mContentWidth = Math.max(mContentWidth, view.getMeasuredWidth() + childMarginHorizontal);
if (contentHeight > 0) {
mContentHeight += contentHeight;
}
} else {
if (params.height == -1) {
extraMeasureHeightSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(extraMeasureHeightSpec), MeasureSpec.EXACTLY);
}
params.measure(view, extraMeasureWidthSpec, extraMeasureHeightSpec);
int contentWidth = view.getMeasuredWidth() + childMarginHorizontal;
if (contentWidth > 0) {
mContentWidth += contentWidth;
}
mContentHeight = Math.max(mContentHeight, view.getMeasuredHeight() + childMarginVertical);
}
setContentSize(mContentWidth, mContentHeight);
childState = view.getMeasuredState();
}
return childState;
}
示例2: measureMiddleViewVertical
import android.view.View; //导入方法依赖的package包/类
protected int measureMiddleViewVertical(int widthMeasureSpec, int heightMeasureSpec, int childFixedSize, int parentRealSize) {
final int childCount = getChildCount();
int childFixedHeightSpec = childFixedSize <= 0 ? 0 : MeasureSpec.makeMeasureSpec(childFixedSize, MeasureSpec.EXACTLY);
int contentWidth = 0;
int contentHeight = 0;
int measuredCount = 0;
int childState = 0;
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == View.GONE || (child == mPageHeaderView || child == mPageFooterView))
continue;
PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) child.getLayoutParams();
int childMarginHorizontal = params.getMarginHorizontal();
int childMarginVertical = params.getMarginVertical();
int childWidthSpec = getMiddleChildMeasureSpec(widthMeasureSpec, 0, childMarginHorizontal, params.width);
int childHeightSpec = childFixedHeightSpec == 0 ? getMiddleChildMeasureSpec(heightMeasureSpec, parentRealSize, childMarginVertical, params.height) : childFixedHeightSpec;
params.measure(child, childWidthSpec, childHeightSpec);
if (mMiddleMargin > 0 && measuredCount > 0) {
contentHeight += mMiddleMargin;
}
contentHeight += (child.getMeasuredHeight() + childMarginVertical);
int itemWidth = child.getMeasuredWidth() + childMarginHorizontal;
if (contentWidth < itemWidth) {
contentWidth = itemWidth;
}
childState |= child.getMeasuredState();
measuredCount++;
}
setContentSize(getContentWidth() + contentWidth, Math.max(getContentHeight(), contentHeight));
return childState;
}
示例3: measureMiddleViewHorizontal
import android.view.View; //导入方法依赖的package包/类
protected int measureMiddleViewHorizontal(int widthMeasureSpec, int heightMeasureSpec, int childFixedSize, final int parentRealSize) {
final int childCount = getChildCount();
int childFixedWidthSpec = childFixedSize <= 0 ? 0 : MeasureSpec.makeMeasureSpec(childFixedSize, MeasureSpec.EXACTLY);
int contentWidth = 0;
int contentHeight = 0;
int measuredCount = 0;
int childState = 0;
for (int i = 0; i < childCount; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == View.GONE || (child == mPageHeaderView || child == mPageFooterView))
continue;
PageScrollView.LayoutParams params = (PageScrollView.LayoutParams) child.getLayoutParams();
int childMarginHorizontal = params.getMarginHorizontal();
int childMarginVertical = params.getMarginVertical();
int childWidthSpec = childFixedWidthSpec == 0 ? getMiddleChildMeasureSpec(widthMeasureSpec, parentRealSize, childMarginHorizontal, params.width) : childFixedWidthSpec;
int childHeightSpec = getMiddleChildMeasureSpec(heightMeasureSpec, 0, childMarginVertical, params.height);
params.measure(child, childWidthSpec, childHeightSpec);
if (mMiddleMargin > 0 && measuredCount > 0) {
contentWidth += mMiddleMargin;
}
contentWidth += (child.getMeasuredWidth() + childMarginHorizontal);
int itemHeight = child.getMeasuredHeight() + childMarginVertical;
if (contentHeight < itemHeight) {
contentHeight = itemHeight;
}
childState |= child.getMeasuredState();
measuredCount++;
}
setContentSize(Math.max(getContentWidth(), contentWidth), getContentHeight() + contentHeight);
return childState;
}
示例4: getMeasuredState
import android.view.View; //导入方法依赖的package包/类
@Override
public int getMeasuredState(View child) {
return child.getMeasuredState();
}
示例5: getMeasuredState
import android.view.View; //导入方法依赖的package包/类
public static int getMeasuredState(View view) {
return view.getMeasuredState();
}
示例6: getMeasuredState
import android.view.View; //导入方法依赖的package包/类
public static int getMeasuredState(View view) {
return view.getMeasuredState();
}