當前位置: 首頁>>代碼示例>>Java>>正文


Java FloatingActionButton.getVisibility方法代碼示例

本文整理匯總了Java中android.support.design.widget.FloatingActionButton.getVisibility方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionButton.getVisibility方法的具體用法?Java FloatingActionButton.getVisibility怎麽用?Java FloatingActionButton.getVisibility使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.design.widget.FloatingActionButton的用法示例。


在下文中一共展示了FloatingActionButton.getVisibility方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
                           View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
                         dyUnconsumed);

    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            /**
             * Called when a FloatingActionButton has been hidden
             *
             * @param fab the FloatingActionButton that was hidden.
             */
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onShown(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        child.show();
    }
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:24,代碼來源:ScrollAwareFab.java

示例2: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    if (((dyConsumed > 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed > 0)) && !isAnimating && child.getVisibility() == View.VISIBLE) {
        if (listener != null) listener.onChange(true);
        AnimHelper.translateDown(child, new MyViewPropertyAnimatorListener() {
            @Override
            public void onAnimationEnd(View view) {
                super.onAnimationEnd(view);
                view.setVisibility(View.INVISIBLE);
            }
        });
    } else if ((dyConsumed < 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed < 0) && !isAnimating && child.getVisibility() == View.INVISIBLE) {
        if (listener != null) listener.onChange(false);
        child.setVisibility(View.VISIBLE);
        AnimHelper.translateUp(child, null);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:TranslateUpDownBehavior.java

示例3: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final
FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
            dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        /** design lib 升級到 25.1.0 導致 child.hide() 效果失效,法克喲
         *  http://stackoverflow.com/questions/41761736/android-design-library-25-1-0-causes-floatingactionbutton-behavior-to-stop-worki
         */
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onHidden(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        child.show();
    }
}
 
開發者ID:li-yu,項目名稱:Huahui-Android,代碼行數:22,代碼來源:FloatingActionButtonScrollBehavior.java

示例4: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
    public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
                               final View target, final int dxConsumed, final int dyConsumed,
                               final int dxUnconsumed, final int dyUnconsumed) {
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
        if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
            // User scrolled down and the FAB is currently visible -> hide the FAB
//            animateOut(child);
            child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
                @Override
                public void onHidden(FloatingActionButton fab) {
                    fab.setVisibility(View.INVISIBLE);
                }
            });
        } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
            // User scrolled up and the FAB is currently not visible -> show the FAB
//            animateIn(child);
            child.show();
        }
    }
 
開發者ID:crazysunj,項目名稱:MultiTypeRecyclerViewAdapter,代碼行數:21,代碼來源:FloatingActionButtonAnimBehavior.java

示例5: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
//        Log.e("自定義: ", "onNestedScroll- dxConsumed:" + dxConsumed + "; dyConsumed: " + dyConsumed + "; dxUnconsumed: " + dxUnconsumed + "; dyUnconsumed: " + dyUnconsumed);

//        if (dyConsumed > 0 && dyUnconsumed == 0) {
//            System.out.println("上滑中。。。");
//        }
//        if (dyConsumed == 0 && dyUnconsumed > 0) {
//            System.out.println("到邊界了還在上滑。。。");
//        }
//        if (dyConsumed < 0 && dyUnconsumed == 0) {
//            System.out.println("下滑中。。。");
//        }
//        if (dyConsumed == 0 && dyUnconsumed < 0) {
//            System.out.println("到邊界了,還在下滑。。。");
//        }

        if (((dyConsumed > 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed > 0)) && child.getVisibility() != View.VISIBLE) {// 顯示
            AnimatorUtil.scaleShow(child, null);
        } else if (((dyConsumed < 0 && dyUnconsumed == 0) || (dyConsumed == 0 && dyUnconsumed < 0)) && child.getVisibility() != View.GONE && !isAnimatingOut) {
            AnimatorUtil.scaleHide(child, viewPropertyAnimatorListener);
        }
    }
 
開發者ID:Pingsh,項目名稱:Mix,代碼行數:24,代碼來源:ScaleUpShowBehavior.java

示例6: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
                           View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
            dyUnconsumed);

    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onShown(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0){
        child.show();
    }
}
 
開發者ID:ndleyton,項目名稱:OneTwo,代碼行數:19,代碼來源:ScrollAwareFABBehavior.java

示例7: 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, int type) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);

    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                // GONE causes it to stop dispatching events...
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        child.show();
    }
}
 
開發者ID:steevp,項目名稱:UpdogFarmer,代碼行數:19,代碼來源:ScrollAwareFabBehavior.java

示例8: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
                           View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
                           int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if(dyConsumed > 0 && child.getVisibility() == View.VISIBLE){
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onHidden(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if(dyConsumed < 0 && child.getVisibility() == View.INVISIBLE){
        child.show();
    }
}
 
開發者ID:xiarunhao123,項目名稱:PureNews,代碼行數:18,代碼來源:ScrollAwareFABBehavior.java

示例9: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
        dyUnconsumed);
    if (dyConsumed > 0 && !this.mIsAnimatingOut &&
        child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        animateOut(child);
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        animateIn(child);
    }
}
 
開發者ID:drakeet,項目名稱:rebase-android,代碼行數:14,代碼來源:ScrollAwareFABBehavior.java

示例10: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
    public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child,
                               View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
        super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
                dyUnconsumed);
        if (dyConsumed > 0 && !mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
//            child.hide();
            animateOut(child);
        } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
//            child.show();
            animateIn(child);
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:ScrollAwareFABBehavior.java

示例11: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
                           final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        child.hide();
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        child.show();
    }
}
 
開發者ID:mecid,項目名稱:robird-reborn,代碼行數:14,代碼來源:ScrollAwareFABBehavior.java

示例12: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
                           final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        animateOut(child);
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        animateIn(child);
    }
}
 
開發者ID:xiarunhao123,項目名稱:Ency,代碼行數:14,代碼來源:ScrollAwareFABBehavior.java

示例13: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
                           @NonNull final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
        animateOut(child);
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        animateIn(child);
    }
}
 
開發者ID:Delsart,項目名稱:Bookster,代碼行數:12,代碼來源:ScrollAwareFABBehavior.java

示例14: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed, final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
            dyUnconsumed);
    if (dyConsumed > 0 && !this.mIsAnimatingOut &&
            child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        animateOut(child);
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        animateIn(child);
    }
}
 
開發者ID:WeiMei-Tian,項目名稱:editor-sql,代碼行數:14,代碼來源:ScrollAwareFABBehavior.java

示例15: onNestedScroll

import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
                           final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        child.hide();
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        child.show();
    }


}
 
開發者ID:LinweiJ,項目名稱:MaterialDesignWidget,代碼行數:16,代碼來源:ScrollAwareFABBehaviorDefault.java


注:本文中的android.support.design.widget.FloatingActionButton.getVisibility方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。