當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。