private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info) { int state = view.getMeasuredHeightAndState() & View.MEASURED_STATE_MASK; return state == View.MEASURED_STATE_TOO_SMALL && info.heightPercent >= 0 && info.mPreservedParams.height == ViewGroup.LayoutParams.WRAP_CONTENT; }
@TargetApi(HONEYCOMB) public S hasMeasuredHeightAndState(int heightAndState) { isNotNull(); int actualHeightAndState = actual.getMeasuredHeightAndState(); assertThat(actualHeightAndState) // .overridingErrorMessage("Expected measured height and state <%s> but was <%s>", heightAndState, actualHeightAndState) // .isEqualTo(heightAndState); return myself; }
public static int getMeasuredHeightAndState(View view) { return view.getMeasuredHeightAndState(); }
private void stretchMeasuredWidth(View v, int lineTotalWidth, int lineCurrentWidth) { int remaining = lineTotalWidth - lineCurrentWidth; int newWidth = v.getMeasuredWidth() + remaining; v.measure(MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY), v.getMeasuredHeightAndState()); }
item.getMeasuredHeightAndState(); Log.d(YOUR_TAG, " datta forloop item.getHeight() " + item.getHeight()); Log.d(YOUR_TAG, " datta forloop item.getMeasuredHeight() " + item.getMeasuredHeight()); Log.d(YOUR_TAG, " datta forloop item.getMeasuredHeightAndState() " + item.getMeasuredHeightAndState()); int itmHeight = item.getHeight(); Log.d(YOUR_TAG, " datta forloop ... itmHeight " + itmHeight);
@TargetApi(HONEYCOMB) public S hasMeasuredHeightAndState(int heightAndState) { isNotNull(); int actualHeightAndState = actual.getMeasuredHeightAndState(); assertThat(actualHeightAndState) // .overridingErrorMessage("Expected measured height and state <%s> but was <%s>", heightAndState, actualHeightAndState) // .isEqualTo(heightAndState); return myself; }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); if (child instanceof HeaderLayout || child instanceof FooterLayout) { child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), child.getMeasuredHeightAndState()); } else { child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), getContentMeasuredHeightState()); } } }
if (mContentView != null) { int contentViewWidth = mContentView.getMeasuredWidthAndState(); contentViewHeight = mContentView.getMeasuredHeightAndState(); LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); int start = getPaddingLeft(); int menuViewWidth = leftMenu.getMeasuredWidthAndState(); int menuViewHeight = leftMenu.getMeasuredHeightAndState(); LayoutParams lp = (LayoutParams) leftMenu.getLayoutParams(); int top = getPaddingTop() + lp.topMargin; int menuViewWidth = rightMenu.getMeasuredWidthAndState(); int menuViewHeight = rightMenu.getMeasuredHeightAndState(); LayoutParams lp = (LayoutParams) rightMenu.getLayoutParams(); int top = getPaddingTop() + lp.topMargin;
int contentViewHeight = mContentView.getMeasuredHeightAndState(); LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); int lGap = getPaddingLeft() + lp.leftMargin; int menuViewHeight = mEndSwiper.getMenuView().getMeasuredHeightAndState(); lp = (LayoutParams) mEndSwiper.getMenuView().getLayoutParams(); lGap = getPaddingLeft() + lp.leftMargin; int menuViewHeight = mBeginSwiper.getMenuView().getMeasuredHeightAndState(); lp = (LayoutParams) mBeginSwiper.getMenuView().getLayoutParams(); lGap = getPaddingLeft() + lp.leftMargin;
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int measuredWidth = getMeasuredWidth(); View tabsContainer = getChildAt(0); if (tabsContainer != null) { int measuredWidthAndState, measuredHeightAndState; ViewGroup.LayoutParams lp = tabsContainer.getLayoutParams(); if (lp.width == LayoutParams.MATCH_PARENT && measuredWidth - getPaddingLeft() - getPaddingRight() > tabsContainer.getMeasuredWidth()) {//tabsContainer宽度不够,让其充满SlidingTabLayout measuredWidthAndState = MeasureSpec.makeMeasureSpec(measuredWidth - getPaddingLeft() - getPaddingRight(), MeasureSpec.EXACTLY); } else if (lp.width != LayoutParams.MATCH_PARENT && lp.width != LayoutParams.WRAP_CONTENT) {//tabsContainer指定了宽度值,使其生效 measuredWidthAndState = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); } else if (lp.height != LayoutParams.WRAP_CONTENT) {//高度不是自适应,说明需要重新测量高度,宽度不做调整 measuredWidthAndState = tabsContainer.getMeasuredWidthAndState(); } else { return; } if (lp.height == LayoutParams.MATCH_PARENT) {//tabsContainer指定最大高度,使其生效 measuredHeightAndState = MeasureSpec.makeMeasureSpec(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(), MeasureSpec.EXACTLY); } else if (lp.height != LayoutParams.WRAP_CONTENT) {//tabsContainer指定高度值,使其生效 measuredHeightAndState = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); } else { measuredHeightAndState = tabsContainer.getMeasuredHeightAndState(); } tabsContainer.measure(measuredWidthAndState, measuredHeightAndState); } }
int parentViewWidth = getMeasuredWidthAndState(); int contentViewWidth = mContentView.getMeasuredWidthAndState(); int contentViewHeight = mContentView.getMeasuredHeightAndState(); LayoutParams lp = (LayoutParams) mContentView.getLayoutParams(); int lGap = getPaddingLeft() + lp.leftMargin; if (mEndSwiper != null) { int menuViewWidth = mEndSwiper.getMenuView().getMeasuredWidthAndState(); int menuViewHeight = mEndSwiper.getMenuView().getMeasuredHeightAndState(); lp = (LayoutParams) mEndSwiper.getMenuView().getLayoutParams(); tGap = getPaddingTop() + lp.topMargin; int menuViewHeight = mBeginSwiper.getMenuView().getMeasuredHeightAndState(); lp = (LayoutParams) mBeginSwiper.getMenuView().getLayoutParams(); tGap = getPaddingTop() + lp.topMargin;
if (lp.width == LayoutParams.MATCH_PARENT) { int stickFirstWidthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize - mPaddingWidth - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY); stickFirst.measure(stickFirstWidthMeasureSpec, stickFirst.getMeasuredHeightAndState()); childState = combineMeasuredStates(childState, stickFirst.getMeasuredState()); childHeightMeasureSpec = skipMeasure ? getChildHeightMeasureSpec(heightMeasureSpec, lp, true) : child.getMeasuredWidthAndState(); } else if (matchHeight) {//高度填满单元格 childWidthMeasureSpec = skipMeasure ? getChildWidthMeasureSpec(widthMeasureSpec, lp, true) : child.getMeasuredHeightAndState(); childHeightMeasureSpec = gridCellMeasureSpec_Height; } else if (skipMeasure) {//宽高都不填满单元格,但是前面跳过了测量
data.put("X", v.getX()); data.put("Y", v.getY()); data.put("MeasuredHeightAndState", v.getMeasuredHeightAndState()); data.put("MeasuredState", v.getMeasuredState()); data.put("MeasuredWidthAndState", v.getMeasuredWidthAndState());