sephiroth74 / Material-BottomNavigation

Bottom Navigation widget component inspired by the Google Material Design Guidelines at https://www.google.com/design/spec/components/bottom-navigation.html
MIT License
1.47k stars 236 forks source link

FAB is always 0dp above BottomNavigation #39

Open fmt-Println-MKO opened 7 years ago

fmt-Println-MKO commented 7 years ago

if the FAB is anchored to BottomNavigation and the Behavior is set on FAB (the one provided)

the FAB is always above BottomNav, doesn't matter which values are set for marginBottom on FAB or marginTop on BottomNav.

the only visible space between them is just the space the shadow takes.

according to Material Design the FAB should be 16dp above, BottomNav or Bottom

kt215 commented 7 years ago

I found a work-around for now:

  1. Copy FloatingActionButtonBehavior.java to your project.
  2. Update FloatingActionButton's app:layout_behavior to use this custom behavior.
  3. On line #87, change the code to: child.setTranslationY(t - dependency.getResources().getDimensionPixelSize(R.dimen.fab_margin));

Should the shadow height be subtracted too? Anyone know how to get the FAB button shadow height?