diff --git a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt index 0bd665736..ea0776e04 100644 --- a/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/TitleBar.kt @@ -18,6 +18,7 @@ import io.legado.app.R import io.legado.app.lib.theme.DrawableUtils import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.getPrimaryTextColor +import io.legado.app.utils.getNavigationBarHeight import io.legado.app.utils.getStatusBarHeight import org.jetbrains.anko.bottomPadding import org.jetbrains.anko.topPadding @@ -99,7 +100,7 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a } if (a.getBoolean(R.styleable.TitleBar_fitNavigationBar, false)) { - bottomPadding = context.getStatusBarHeight() + bottomPadding = context.getNavigationBarHeight() } a.recycle() diff --git a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt index 94eb8a122..50f9475a1 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -57,3 +57,8 @@ fun Context.getStatusBarHeight(): Int { val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android") return resources.getDimensionPixelSize(resourceId) } + +fun Context.getNavigationBarHeight(): Int { + val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android") + return resources.getDimensionPixelSize(resourceId) +}