BottomAppBar widget from support library in com.android.support package has isFabAttached flag and method. In 28.0.0-alpha1 version it has public access. But after release of stable version 28.0.0 it is not available any more.
I used bottomAppBar.isFabAttached = false
for animated detach and bottomAppBar.isFabAttached = true
for vertical attach animations. But after update to com.android.support:design:28.0.0 isFabAttached
has private access and as result animation doesn't work. Only horizontal animation is available for now.
How to animate fab button like on this picture for last release version of com.android.support:design:28.0.0
library?
UPDATE: the issue resolved, I have copied the code from BottomAppBar and created a custom view: CustomBottomAppBar in the android.support.design.bottomappbar package and added next code:
public void setFabAttached(boolean attached) {
maybeAnimateAttachChange(attached);
maybeAnimateMenuView(fabAlignmentMode, attached);
this.fabAttached = attached;
}
private void maybeAnimateAttachChange(boolean targetAttached) {
if (fabAttached == targetAttached || !ViewCompat.isLaidOut(this)) {
return;
}
if (attachAnimator != null) {
attachAnimator.cancel();
}
List<Animator> animators = new ArrayList<>();
createCradleShapeAnimation(targetAttached, animators);
createFabTranslationYAnimation(targetAttached, animators);
AnimatorSet set = new AnimatorSet();
set.playTogether(animators);
attachAnimator = set;
attachAnimator.addListener(
new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
attachAnimator = null;
}
});
attachAnimator.start();
}