本文整理汇总了Java中android.support.design.widget.FloatingActionButton.isShown方法的典型用法代码示例。如果您正苦于以下问题:Java FloatingActionButton.isShown方法的具体用法?Java FloatingActionButton.isShown怎么用?Java FloatingActionButton.isShown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.isShown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNestedScroll
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull FloatingActionButton child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
//Logger.d("FABBehavour", String.valueOf(dyConsumed));
if (child.isShown() && dyConsumed > 0) {
child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
@Override
public void onHidden(FloatingActionButton fab) {
super.onHidden(fab);
fab.setVisibility(View.INVISIBLE);
}
});
} else if (!child.isShown() && dyConsumed < 0) {
child.show();
}
}
示例2: onScrolled
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
super.onScrolled(view, dx, dy);
ActionButtonActivity activity = (ActionButtonActivity) getActivity();
FloatingActionButton composeButton = activity.getActionButton();
if (composeButton != null) {
if (hideFab) {
if (dy > 0 && composeButton.isShown()) {
composeButton.hide(); // hides the button if we're scrolling down
} else if (dy < 0 && !composeButton.isShown()) {
composeButton.show(); // shows it if we are scrolling up
}
} else if (!composeButton.isShown()) {
composeButton.show();
}
}
}
示例3: updateFabTranslationForBottomNavigationBar
import android.support.design.widget.FloatingActionButton; //导入方法依赖的package包/类
private void updateFabTranslationForBottomNavigationBar(CoordinatorLayout parent, FloatingActionButton fab, View dependency) {
float snackBarTranslation = getFabTranslationYForSnackBar(parent, fab);
float[] bottomBarParameters = getFabTranslationYForBottomNavigationBar(parent, fab);
float bottomBarTranslation = bottomBarParameters[0];
float bottomBarHeight = bottomBarParameters[1];
float targetTransY = 0;
if (snackBarTranslation >= bottomBarTranslation) {
// when snackBar is below BottomBar in translation present.
targetTransY = bottomBarTranslation;
} else {
targetTransY = snackBarTranslation;
}
// if (mFabBehaviour == BottomNavigationBar.FAB_BEHAVIOUR_DISAPPEAR) {
// if (targetTransY == 0) {
// fab.hide();
// } else {
// fab.show();
// }
// }
final float currentTransY = ViewCompat.getTranslationY(fab);
// Make sure that any current animation is cancelled
ensureOrCancelAnimator(fab);
if (fab.isShown()
&& Math.abs(currentTransY - targetTransY) > (fab.getHeight() * 0.667f)) {
// If the FAB will be travelling by more than 2/3 of it's height, let's animate it instead
mFabTranslationYAnimator.translationY(targetTransY).start();
} else {
// Now update the translation Y
ViewCompat.setTranslationY(fab, targetTransY);
}
}