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