本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}