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


Java FloatingActionButton.isShown方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:18,代码来源:FABBehavior.java

示例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();
        }
    }
}
 
开发者ID:Vavassor,项目名称:Tusky,代码行数:20,代码来源:TimelineFragment.java

示例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);
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:BottomNavBarFabBehaviour.java


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