本文整理匯總了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);
}
}