當前位置: 首頁>>代碼示例>>Java>>正文


Java View.getFitsSystemWindows方法代碼示例

本文整理匯總了Java中android.view.View.getFitsSystemWindows方法的典型用法代碼示例。如果您正苦於以下問題:Java View.getFitsSystemWindows方法的具體用法?Java View.getFitsSystemWindows怎麽用?Java View.getFitsSystemWindows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.getFitsSystemWindows方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMeasure

import android.view.View; //導入方法依賴的package包/類
@SuppressLint("NewApi")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);

    setMeasuredDimension(widthSize, heightSize);

    final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;

    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE) {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (applyInsets) {
            if (child.getFitsSystemWindows()) {
                dispatchChildInsets(child, lastInsets, lp.gravity);
            } else if (child.getTag() == null) {
                applyMarginInsets(lp, lastInsets, lp.gravity, Build.VERSION.SDK_INT >= 21);
            }
        }

        if (drawerLayout != child) {
            final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
            final int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
            child.measure(contentWidthSpec, contentHeightSpec);
        } else {
            child.setPadding(0, 0, 0, 0);
            final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, minDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);
            final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);
            child.measure(drawerWidthSpec, drawerHeightSpec);
        }
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:41,代碼來源:DrawerLayoutContainer.java

示例2: jumpDispatch

import android.view.View; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@TargetApi(19)
private boolean jumpDispatch(View child) {
    return !child.getFitsSystemWindows() &&
            !(child instanceof QMUIWindowInsetLayout) &&
            !(child instanceof CoordinatorLayout);
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:8,代碼來源:QMUIWindowInsetHelper.java

示例3: getFitsSystemWindows

import android.view.View; //導入方法依賴的package包/類
public static boolean getFitsSystemWindows(View view) {
    return view.getFitsSystemWindows();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:ViewCompatJB.java

示例4: onMeasure

import android.view.View; //導入方法依賴的package包/類
@SuppressLint("NewApi")
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int widthSize = MeasureSpec.getSize(widthMeasureSpec);
    int heightSize = MeasureSpec.getSize(heightMeasureSpec);

    setMeasuredDimension(widthSize, heightSize);

    final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;

    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);

        if (child.getVisibility() == GONE) {
            continue;
        }

        final LayoutParams lp = (LayoutParams) child.getLayoutParams();

        if (applyInsets) {
            if (child.getFitsSystemWindows()) {
                dispatchChildInsets(child, lastInsets, lp.gravity);
            } else if (child.getTag() == null) {
                applyMarginInsets(lp, lastInsets, lp.gravity, Build.VERSION.SDK_INT >= 21);
            }
        }

        if (drawerLayout != child) {
            final int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize - lp.leftMargin - lp.rightMargin, MeasureSpec.EXACTLY);
            final int contentHeightSpec = MeasureSpec.makeMeasureSpec(heightSize - lp.topMargin - lp.bottomMargin, MeasureSpec.EXACTLY);
            child.measure(contentWidthSpec, contentHeightSpec);
        } else {
            child.setPadding(0, 0, 0, 0);
            final int drawerWidthSpec = getChildMeasureSpec(widthMeasureSpec, minDrawerMargin + lp.leftMargin + lp.rightMargin, lp.width);
            final int drawerHeightSpec = getChildMeasureSpec(heightMeasureSpec, lp.topMargin + lp.bottomMargin, lp.height);
            child.measure(drawerWidthSpec, drawerHeightSpec);
        }
    }
    //Telegram
    updateListBG();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:43,代碼來源:DrawerLayoutContainer.java

示例5: jumpDispatch

import android.view.View; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@TargetApi(19)
public static boolean jumpDispatch(View child) {
    return !child.getFitsSystemWindows() && !isHandleContainer(child);
}
 
開發者ID:QMUI,項目名稱:QMUI_Android,代碼行數:6,代碼來源:QMUIWindowInsetHelper.java


注:本文中的android.view.View.getFitsSystemWindows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。