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


Java CoordinatorLayout.getDependencies方法代码示例

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


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

示例1: getFabTranslationYForBottomNavigationBar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float[] getFabTranslationYForBottomNavigationBar(CoordinatorLayout parent,
                                                         FloatingActionButton fab) {
    float minOffset = 0;
    float viewHeight = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof BottomNavigationBar) {
            viewHeight = view.getHeight();
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - viewHeight);
        }
    }
    float[] returnValues = {minOffset, viewHeight};

    return returnValues;
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:18,代码来源:BottomNavBarFabBehaviour.java

示例2: layoutChild

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override
protected void layoutChild(final CoordinatorLayout parent, final View child, final int layoutDirection) {
    final List<View> dependencies = parent.getDependencies(child);
    final View header = findFirstDependency(dependencies);

    if (header != null) {
        final CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        final Rect available = mTempRect1;
        available.set(parent.getPaddingLeft() + lp.leftMargin, header.getBottom() + lp.topMargin,
                parent.getWidth() - parent.getPaddingRight() - lp.rightMargin,
                parent.getHeight() + header.getBottom() - parent.getPaddingBottom() - lp.bottomMargin);

        final Rect out = mTempRect2;
        GravityCompat.apply(resolveGravity(lp.gravity), child.getMeasuredWidth(), child.getMeasuredHeight(), available, out, layoutDirection);

        final int overlap = getOverlapPixelsForOffset(header);

        child.layout(out.left, out.top - overlap, out.right, out.bottom - overlap);
        mVerticalLayoutGap = out.top - header.getBottom();
    } else {
        // If we don't have a dependency, let super handle it
        super.layoutChild(parent, child, layoutDirection);
        mVerticalLayoutGap = 0;
    }
}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:26,代码来源:HeaderScrollingViewBehavior.java

示例3: getSnackBarInstance

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private Snackbar.SnackbarLayout getSnackBarInstance(CoordinatorLayout parent, V child) {
    final List<View> dependencies = parent.getDependencies(child);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout) {
            return (Snackbar.SnackbarLayout) view;
        }
    }
    return null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:BottomVerticalScrollBehavior.java

示例4: getFabTranslationYForSnackBar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float getFabTranslationYForSnackBar(CoordinatorLayout parent,
                                            FloatingActionButton fab) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:BottomNavBarFabBehaviour.java

示例5: getFabTranslationYForSnackbar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
                                            View fab) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:MyCommentBehavior.java

示例6: getTranslationYForSnackbar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float getTranslationYForSnackbar(CoordinatorLayout parent, CircleIndicator ci) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(ci);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(ci, view)) {
            minOffset =
                    Math.min(minOffset, ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:SnackbarBehavior.java

示例7: getFabTranslationYForSnackbar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
/**
 * Find the {@code translation Y} value for any child Snackbar components.
 *
 * @return 0.0F if there are no Snackbar components found, otherwise returns the min offset that
 * the FAB component should be animated.
 */
private float getFabTranslationYForSnackbar(CoordinatorLayout parent, View fab) {
    float minOffset = 0.0F;
    final List<View> dependencies = parent.getDependencies(fab);

    for (View view : dependencies) {
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset, view.getTranslationY() - (float) view.getHeight());
        }
    }

    return minOffset;
}
 
开发者ID:jahirfiquitiva,项目名称:FABsMenu,代码行数:19,代码来源:FABSnackbarBehavior.java

示例8: onDependentViewChanged

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
@Override public boolean onDependentViewChanged(@NonNull
                                                final CoordinatorLayout parent, @NonNull
                                                final FloatingActionButton child, final View dependency) {
    log(TAG, INFO, "onDependentViewChanged: " + dependency);
    final List<View> list = parent.getDependencies(child);
    ViewGroup.MarginLayoutParams params = ((ViewGroup.MarginLayoutParams) child.getLayoutParams());
    int bottomMargin = (params.bottomMargin + params.rightMargin) - (params.topMargin + params.leftMargin);
    float t = 0;
    float t2 = 0;
    float t3 = 0;
    boolean result = false;
    for (View dep : list) {
        if (Snackbar.SnackbarLayout.class.isInstance(dep)) {
            t += dep.getTranslationY() - dep.getHeight();
            result = true;
        } else if (BottomNavigation.class.isInstance(dep)) {
            BottomNavigation navigation = (BottomNavigation) dep;
            t2 = navigation.getTranslationY() - navigation.getHeight() + bottomMargin;
            t += t2;
            result = true;

            if (navigationBarHeight > 0) {
                if (!navigation.isExpanded()) {
                    child.hide();
                } else {
                    child.show();
                }
            }
        }
    }

    if (navigationBarHeight > 0 && t2 < 0) {
        t = Math.min(t2, t + navigationBarHeight);
    }

    child.setTranslationY(t);
    return result;
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:39,代码来源:FloatingActionButtonBehavior.java

示例9: getFabTranslationYForSnackbar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float getFabTranslationYForSnackbar(CoordinatorLayout parent,
                                            FabSpeedDial fab) {
    float minOffset = 0;
    final List<View> dependencies = parent.getDependencies(fab);
    for (int i = 0, z = dependencies.size(); i < z; i++) {
        final View view = dependencies.get(i);
        if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(fab, view)) {
            minOffset = Math.min(minOffset,
                    ViewCompat.getTranslationY(view) - view.getHeight());
        }
    }

    return minOffset;
}
 
开发者ID:Alcatraz323,项目名称:MaterialOCR,代码行数:15,代码来源:FabSpeedDialBehaviour.java

示例10: 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

示例11: getTranslationYForSnackbar

import android.support.design.widget.CoordinatorLayout; //导入方法依赖的package包/类
private float getTranslationYForSnackbar(CoordinatorLayout parent, FooterLayout footerLayout) {

        float minOffset = 0;
        final List<View> dependencies = parent.getDependencies(footerLayout);
        for (int i = 0, z = dependencies.size(); i < z; i++) {
            final View view = dependencies.get(i);
            if (view instanceof Snackbar.SnackbarLayout && parent.doViewsOverlap(footerLayout, view)) {
                minOffset = Math.min(minOffset, ViewCompat.getTranslationY(view) - view.getHeight());
            }
        }

        return minOffset;
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:14,代码来源:FooterBehavior.java


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