Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BottomBarAndSnackBar

funnelbit
December 26, 2016

 BottomBarAndSnackBar

funnelbit

December 26, 2016
Tweet

More Decks by funnelbit

Other Decks in Technology

Transcript

  1. "DUJWJUZ #PUUPN#BS   'SBHNFOU 4OBDL#BS w 3FMBUJWF-BZPVU w "QQCBS

    w $PPSEJOBUPS-BZPVU w 'SBHNFOU w $PPSEJOBUPS-BZPVU w 5PPMCBS w 3FMBUJWF-BZPVU w "DUJWJUZͷϨΠΞ΢τΛॻ͖׵͑Δ
  2. "DUJWJUZͷ#FIBWJPSͰͳΜ ͱ͔͢Δʁ if (dependency instanceof Snackbar.SnackbarLayout) {
 int targetPadding =

    Math.max(0, bottomBar.getMeasuredHeight() - (int) (bottomBar.getY() - bottomBar.getTop()));
 dependency.setPadding(dependency.getPaddingLeft(), dependency.getPaddingTop(), dependency.getPaddingRight(), targetPadding);
 } w #PUUPN#BSͷ#FIBWJPSͱͯ͜͠ΜͳͷΛॻ͘
  3. ݹ͍όʔδϣϯΛߟྀ // ΋͠΋ KITKAT ҎԼͰ͋Δ৔߹ɺelevation ͕࢖͑ͳ͍ͨΊɺbottomBar ͷ্ʹ Snackbar ͕ඃͬͯ͞͠·͏ɻ
 //

    ͦ͜Ͱ bringToFront() Λ࢖͍ɺॏͶॱΛม͑Δɻ
 if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
 bottomBar.bringToFront();
 // KITKAT ΑΓલͷόʔδϣϯͷ৔߹ɺrequestLayout() ͱ invalidate() Λݺ͹ͳ͚Ε͹ ॏͶॱͷมߋ͕ͳ͞Εͳ͍ɻ
 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
 bottomBar.getParent().requestLayout();
 ((View) bottomBar.getParent()).invalidate();
 }
 }
 return true; w #PUUPN#BSͷ#FIBWJPSͱͯ͜͠ΜͳͷΛॻ͘ʢଓ͖ʣ
  4. -BZPVU "DUJWJUZ w $PPSEJOBUPS-BZPVU w "QQ#BS w 'SBHNFOU w #PUUPN#BS$POUBJOFS

    w $PPSEJOBUPS-BZPVU w #PUUPN#BS$POUFOU w $PPSEJOBUPS-BZPVU