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


Java CoordinatorLayout.onLayoutChild方法代码示例

本文整理汇总了Java中android.support.design.widget.CoordinatorLayout.onLayoutChild方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinatorLayout.onLayoutChild方法的具体用法?Java CoordinatorLayout.onLayoutChild怎么用?Java CoordinatorLayout.onLayoutChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.CoordinatorLayout的用法示例。


在下文中一共展示了CoordinatorLayout.onLayoutChild方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, final V child, int layoutDirection) {
    // First let the parent lay it out
    parent.onLayoutChild(child, layoutDirection);
    if (child instanceof BottomNavigationBar) {
        mViewRef = new WeakReference<>((BottomNavigationBar) child);
    }

    child.post(new Runnable() {
        @Override
        public void run() {
            mBottomNavHeight = child.getHeight();
        }
    });
    updateSnackBarPosition(parent, child, getSnackBarInstance(parent, child));

    return super.onLayoutChild(parent, child, layoutDirection);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:BottomVerticalScrollBehavior.java

示例2: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, StretchView child, int layoutDirection) {
    if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
        ViewCompat.setFitsSystemWindows(child, true);
    }
    parent.onLayoutChild(child, layoutDirection);
    //设置起始位置
    switch (child.getDirection()) {
        case StretchView.LEFT:
            ViewCompat.offsetLeftAndRight(child, -child.getWidth() + mTranslation);
            break;
        case StretchView.RIGHT:
            ViewCompat.offsetLeftAndRight(child, parent.getWidth() - child.getLeft() - parent.getPaddingRight() + mTranslation);
            break;
        case StretchView.BOTTOM:
            ViewCompat.offsetTopAndBottom(child, parent.getHeight() - child.getTop() - parent.getPaddingBottom() + mTranslation);
            break;
    }
    return true;
}
 
开发者ID:thunderpunch,项目名称:StretchView,代码行数:21,代码来源:StretchView.java

示例3: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, FloatingActionButton child, int layoutDirection) {
    // First let the parent lay it out
    parent.onLayoutChild(child, layoutDirection);

    updateFabTranslationForBottomNavigationBar(parent, child, null);

    return super.onLayoutChild(parent, child, layoutDirection);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BottomNavBarFabBehaviour.java

示例4: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
    if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
        ViewCompat.setFitsSystemWindows(child, true);
    }
    int savedTop = child.getTop();
    // First let the parent lay it out
    parent.onLayoutChild(child, layoutDirection);
    // Offset the bottom sheet
    mParentHeight = parent.getHeight();
    int peekHeight;
    if (mPeekHeightAuto) {
        if (mPeekHeightMin == 0) {
            mPeekHeightMin = parent.getResources().getDimensionPixelSize(
                    R.dimen.design_bottom_sheet_peek_height_min);
        }
        peekHeight = Math.max(mPeekHeightMin, mParentHeight - parent.getWidth() * 9 / 16);
    } else {
        peekHeight = mPeekHeight;
    }
    mMinOffset = Math.max(0, mParentHeight - child.getHeight());
    mMaxOffset = Math.max(mParentHeight - peekHeight, mMinOffset);
    if (mState == STATE_EXPANDED) {
        ViewCompat.offsetTopAndBottom(child, mMinOffset);
    } else if (mHideable && mState == STATE_HIDDEN) {
        ViewCompat.offsetTopAndBottom(child, mParentHeight);
    } else if (mState == STATE_COLLAPSED) {
        ViewCompat.offsetTopAndBottom(child, mMaxOffset);
    } else if (mState == STATE_DRAGGING || mState == STATE_SETTLING) {
        ViewCompat.offsetTopAndBottom(child, savedTop - child.getTop());
    }
    if (mViewDragHelper == null) {
        mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
    }
    mViewRef = new WeakReference<>(child);
    mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));
    return true;
}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:39,代码来源:ViewPagerBottomSheetBehavior.java

示例5: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
    // First let the parent lay it out
    if (mState != STATE_DRAGGING && mState != STATE_SETTLING) {
        if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
            ViewCompat.setFitsSystemWindows(child, true);
        }
        parent.onLayoutChild(child, layoutDirection);
    }
    // Offset the bottom sheet
    mParentHeight = parent.getHeight();
    mMinOffset = Math.max(0, mParentHeight - child.getHeight());
    mMaxOffset = Math.max(mParentHeight - mPeekHeight, mMinOffset);
    mAnchorOffset = (int) Math.max(mParentHeight * mAnchorThreshold, mMinOffset);
    if (mState == STATE_EXPANDED) {
        ViewCompat.offsetTopAndBottom(child, mMinOffset);
    } else if (mState == STATE_ANCHOR) {
        ViewCompat.offsetTopAndBottom(child, mAnchorOffset);
    } else if (mHideable && mState == STATE_HIDDEN) {
        ViewCompat.offsetTopAndBottom(child, mParentHeight);
    } else if (mState == STATE_COLLAPSED) {
        ViewCompat.offsetTopAndBottom(child, mMaxOffset);
    }
    if (mViewDragHelper == null) {
        mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
    }
    mViewRef = new WeakReference<>(child);
    mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));
    return true;
}
 
开发者ID:alphater,项目名称:garras,代码行数:31,代码来源:AnchorSheetBehavior.java

示例6: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
    if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
        ViewCompat.setFitsSystemWindows(child, true);
    }
    int savedTop = child.getTop();
    // First let the parent lay it out
    parent.onLayoutChild(child, layoutDirection);
    // Offset the bottom sheet
    mParentHeight = parent.getHeight();
    int peekHeight;
    if (mPeekHeightAuto) {
        if (mPeekHeightMin == 0) {
            mPeekHeightMin = parent.getResources().getDimensionPixelSize(
                    android.support.design.R.dimen.design_bottom_sheet_peek_height_min);
        }
        peekHeight = Math.max(mPeekHeightMin, mParentHeight - parent.getWidth() * 9 / 16);
    } else {
        peekHeight = mPeekHeight;
    }
    mMinOffset = Math.max(0, mParentHeight - child.getHeight());
    mMaxOffset = Math.max(mParentHeight - peekHeight, mMinOffset);
    if (mState == STATE_EXPANDED) {
        ViewCompat.offsetTopAndBottom(child, mMinOffset);
    } else if (mHideable && mState == STATE_HIDDEN) {
        ViewCompat.offsetTopAndBottom(child, mParentHeight);
    } else if (mState == STATE_COLLAPSED) {
        ViewCompat.offsetTopAndBottom(child, mMaxOffset);
    } else if (mState == STATE_DRAGGING || mState == STATE_SETTLING) {
        ViewCompat.offsetTopAndBottom(child, savedTop - child.getTop());
    }
    if (mViewDragHelper == null) {
        mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
    }
    mViewRef = new WeakReference<>(child);
    mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));
    return true;
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:39,代码来源:BottomSheetBehaviorV2.java

示例7: onLayoutChildFixed

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
public boolean onLayoutChildFixed(CoordinatorLayout parent, V child, int layoutDirection) {
    if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
        ViewCompat.setFitsSystemWindows(child, true);
    }
    int savedTop = child.getTop();
    // First let the parent lay it out
    parent.onLayoutChild(child, layoutDirection);
    // Offset the bottom sheet
    mParentHeight = parent.getHeight();
    int peekHeight;
    if (mPeekHeightAuto) {
        if (mPeekHeightMin == 0) {
            mPeekHeightMin = parent.getResources().getDimensionPixelSize(
                    android.support.design.R.dimen.design_bottom_sheet_peek_height_min);
        }
        peekHeight = Math.max(mPeekHeightMin, mParentHeight - parent.getWidth() * 9 / 16);
    } else {
        peekHeight = mPeekHeight;
    }
    mMinOffset = Math.max(0, mParentHeight - child.getHeight());
    mMaxOffset = Math.max(mParentHeight - peekHeight, mMinOffset);
    if (mState == STATE_EXPANDED) {
        ViewCompat.offsetTopAndBottom(child, mMinOffset);
    } else if (mHideable && mState == STATE_HIDDEN) {
        ViewCompat.offsetTopAndBottom(child, mParentHeight);
    } else if (mState == STATE_COLLAPSED) {
        ViewCompat.offsetTopAndBottom(child, mMaxOffset);
    } else if (mState == STATE_DRAGGING || mState == STATE_SETTLING) {
        ViewCompat.offsetTopAndBottom(child, savedTop - child.getTop());
    }
    if (mViewDragHelper == null) {
        mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
    }
    mViewRef = new WeakReference<>(child);
    mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));
    return true;
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:38,代码来源:BottomSheetBehaviorV2.java

示例8: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
    // FIXME: 16/7/27 不知道为啥在XML设置-45dip,解析出来的topMargin少了1个px,所以这里用代码设置一遍
    ((CoordinatorLayout.LayoutParams) child.getLayoutParams()).topMargin = -getTitleHeight();
    parent.onLayoutChild(child, layoutDirection);
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "layoutChild:top" + child.getTop() + ",height" + child.getHeight());
    }
    return true;
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:11,代码来源:UcNewsTitleBehavior.java

示例9: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, FabSpeedDial child, int layoutDirection) {
    // First, lets make sure that the visibility of the FAB is consistent
    final List<View> dependencies = parent.getDependencies(child);
    for (int i = 0, count = dependencies.size(); i < count; i++) {
        final View dependency = dependencies.get(i);
        if (dependency instanceof AppBarLayout
                && updateFabVisibility(parent, (AppBarLayout) dependency, child)) {
            break;
        }
    }
    // Now let the CoordinatorLayout lay out the FAB
    parent.onLayoutChild(child, layoutDirection);
    return true;
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:16,代码来源:FabSpeedDialBehaviour.java

示例10: onLayoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
    // First let the parent lay it out
    if (mState != STATE_DRAGGING && mState != STATE_SETTLING) {
        if (ViewCompat.getFitsSystemWindows(parent) &&
                !ViewCompat.getFitsSystemWindows(child)) {
            ViewCompat.setFitsSystemWindows(child, true);
        }
        parent.onLayoutChild(child, layoutDirection);
    }
    // Offset the bottom sheet
    mParentHeight = parent.getHeight();
    mMinOffset = Math.max(0, mParentHeight - child.getHeight());
    mMaxOffset = Math.max(mParentHeight - mPeekHeight, mMinOffset);

    /**
     * New behavior
     */
    if (mState == STATE_ANCHOR_POINT) {
        ViewCompat.offsetTopAndBottom(child, mAnchorPoint);
    } else if (mState == STATE_EXPANDED) {
        ViewCompat.offsetTopAndBottom(child, mMinOffset);
    } else if (mHideable && mState == STATE_HIDDEN) {
        ViewCompat.offsetTopAndBottom(child, mParentHeight);
    } else if (mState == STATE_COLLAPSED) {
        ViewCompat.offsetTopAndBottom(child, mMaxOffset);
    }
    if (mViewDragHelper == null) {
        mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
    }
    mViewRef = new WeakReference<>(child);
    mNestedScrollingChildRef = new WeakReference<>(findScrollingChild(child));
    return true;
}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:35,代码来源:BottomSheetBehaviorGoogleMapsLike.java

示例11: layoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
    // Let the parent lay it out by default
    parent.onLayoutChild(child, layoutDirection);
}
 
开发者ID:huyongli,项目名称:UCMainViewForBehavior,代码行数:5,代码来源:ViewOffsetBehavior.java


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