當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。