5

我正在尝试创建一个类似于Google Photos应用程序 UI 的应用程序。支持库版本 = 25.1.0。

问题在于半透明状态和导航栏,里面的小部件CoorinatorLayout看起来不像预期的那样。设置fitsSystemWindows=true属性BottomNavigationView使其太大(屏幕截图 1),SnakBar在这种情况下出现在导航栏后面,而不是BottomNavView如预期的那样在导航栏上方。如果我添加fitsSystemWindows=trueToolbar屏幕截图 2),那么 BottomNavigationView 会失去它的fitsSystemWindows属性,并且Toolbar内容会消失在某个地方。它看起来像一个支持库错误,但我不确定。

这是我的 DSL 代码:

       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
                    }
                }
            }

在此处输入图像描述在此处输入图像描述

4

0 回答 0