当前位置: 首页>>代码示例>>Java>>正文


Java View.getMeasuredState方法代码示例

本文整理汇总了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;
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:36,代码来源:PageScrollView.java

示例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;
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:32,代码来源:PageScrollView.java

示例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;
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:32,代码来源:PageScrollView.java

示例4: getMeasuredState

import android.view.View; //导入方法依赖的package包/类
@Override
public int getMeasuredState(View child) {
    return child.getMeasuredState();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:5,代码来源:Utility11.java

示例5: getMeasuredState

import android.view.View; //导入方法依赖的package包/类
public static int getMeasuredState(View view) {
    return view.getMeasuredState();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:ViewCompatHC.java

示例6: getMeasuredState

import android.view.View; //导入方法依赖的package包/类
public static int getMeasuredState(View view) {
  return view.getMeasuredState();
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:4,代码来源:HoneycombUtil.java


注:本文中的android.view.View.getMeasuredState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。