5

I'm trying to create an application with similar to Google Photos app UI. Support Libary Version = 25.1.0.

The problem in that with translucent status and navigation bars, widgets inside CoorinatorLayout looks not as expected. Setting fitsSystemWindows=true attribute for the BottomNavigationView makes it too large (screenshot 1) and SnakBar in that case appears behind navigation bar, not above BottomNavView or nav bar as expected. If I add fitsSystemWindows=true in Toolbar (screenshot 2) then BottomNavigationView looses it's fitsSystemWindows attribute and Toolbar content gone somewhere. It looks as a support library bug, but I'm not sure in that.

Here is my DSL code:

       coordinatorLayout {

                customToolbar {
                    id = TOOLBAR
//                  fitsSystemWindows = true
                    title = createTitle(ctx)
                    lparams(matchParent, dip(48))
                }

                frameLayout {
                    id = CONTENT_FRAME
                    backgroundResource = R.color.colorBackground
                    lparams(matchParent, matchParent)
                }

                bottomNavigationView(R.style.Base_ThemeOverlay_AppCompat_Dark) {
                    id = BOTTOM_NAVIGATION_VIEW

                    fitsSystemWindows = true
                    itemIconTintList = ContextCompat.getColorStateList(ctx, R.drawable.nav_item_color_state)
                    itemTextColor = ContextCompat.getColorStateList(ctx, R.drawable.nav_item_color_state)
                    backgroundResource = R.color.colorAccent
                    inflateMenu(R.menu.menu_drawer_2)
                    lparams(matchParent) {
                        anchorGravity = Gravity.BOTTOM
                        anchorId = CONTENT_FRAME
                    }
                }
            }

enter image description hereenter image description here

Near1999
  • 1,547
  • 2
  • 18
  • 37
  • Any specific reason why you are not using the latest support libraries? Also, do you have any custom theme defines under values/styles.xml ? – anthonymonori Jan 02 '18 at 10:40
  • Screenshot 1 - the bottom bar is not too large. It's supposed to extend behind the navigation bar if it's translucent. /// Try wrapping the Toolbar in an AppBarLayout with fitsSystemWindows instead. – Eugen Pechanec Apr 30 '18 at 23:41

0 Answers0