/*** 动画隐藏浮动按钮*/
private voidhidenFabAnim() {if (!isFabAnimg && mActionButton != null && mActionButton.getVisibility() ==View.VISIBLE) {
Animator animator= ObjectAnimator.ofFloat(mActionButton, "translationY", 0f, 100f);
animator.setDuration(500);
animator.addListener(newAnimator.AnimatorListener() {
@Overridepublic voidonAnimationStart(Animator animation) {
isFabAnimg= true;
}
@Overridepublic voidonAnimationEnd(Animator animation) {
isFabAnimg= false;
mActionButton.setVisibility(View.GONE);
}
@Overridepublic voidonAnimationCancel(Animator animation) {
isFabAnimg= false;
}
@Overridepublic voidonAnimationRepeat(Animator animation) {
}
});
animator.start();
}
}/*** 动画显示浮动按钮*/
private voidshowFabAnim(){if (mActionButton != null && !isFabAnimg && mActionButton.getVisibility() ==View.GONE) {
Animator animator= ObjectAnimator.ofFloat(mActionButton,"translationY",100f,0f);
animator.setDuration(500);
animator.addListener(newAnimator.AnimatorListener() {
@Overridepublic voidonAnimationStart(Animator animation) {
isFabAnimg= true;
}
@Overridepublic voidonAnimationEnd(Animator animation) {
isFabAnimg= false;
}
@Overridepublic voidonAnimationCancel(Animator animation) {
isFabAnimg= false;
}
@Overridepublic voidonAnimationRepeat(Animator animation) {
}
});
mActionButton.setVisibility(View.VISIBLE);
animator.start();
}
}