android.support.v4.view.ViewCompat#getMeasuredHeightAndState ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#getMeasuredHeightAndState ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final ViewPager viewPager = mViewPager;
    measureChild(viewPager, widthMeasureSpec, heightMeasureSpec);

    final int measuredWidthAndState = ViewCompat.getMeasuredWidthAndState(viewPager);
    final int measuredHeightAndState = ViewCompat.getMeasuredHeightAndState(viewPager);
    setMeasuredDimension(measuredWidthAndState, measuredHeightAndState);

    final int pagerWidth = viewPager.getMeasuredWidth();
    final int pagerHeight = viewPager.getMeasuredHeight();
    final int buttonWidthSpec = MeasureSpec.makeMeasureSpec(pagerWidth, MeasureSpec.AT_MOST);
    final int buttonHeightSpec = MeasureSpec.makeMeasureSpec(pagerHeight, MeasureSpec.AT_MOST);
    mPrevButton.measure(buttonWidthSpec, buttonHeightSpec);
    mNextButton.measure(buttonWidthSpec, buttonHeightSpec);
}
 
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info)
{
    int state = ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    if (info == null || info.heightPercent == null)
    {
        return false;
    }
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.heightPercent.percent >= 0 &&
            info.mPreservedParams.height == ViewGroup.LayoutParams.WRAP_CONTENT;
}
 
源代码3 项目: FimiX8-RE   文件: PercentLayoutHelper.java
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info) {
    if (info == null || info.heightPercent == null || info.mPreservedParams == null || (ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK) != 16777216 || info.heightPercent.percent < 0.0f || info.mPreservedParams.height != -2) {
        return false;
    }
    return true;
}
 
源代码4 项目: JD-Test   文件: PercentLayoutHelper.java
private static boolean shouldHandleMeasuredHeightTooSmall(View view, PercentLayoutInfo info) {
    int state = ViewCompat.getMeasuredHeightAndState(view) & ViewCompat.MEASURED_STATE_MASK;
    return state == ViewCompat.MEASURED_STATE_TOO_SMALL && info.heightPercent >= 0 &&
            info.mPreservedParams.height == ViewGroup.LayoutParams.WRAP_CONTENT;
}
 
 同类方法