Skip to content
Android library for enabling edge-to-edge content and insetting views using simple Kotlin DSL
Branch: master
Clone or download
Latest commit 34601ae Jan 20, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
app New Edge.All shortcut edge Jan 7, 2020
gradle/wrapper Initial edge-to-edge implementation Dec 24, 2019
.gitignore New Edge.All shortcut edge Jan 7, 2020
LICENSE Initial commit Dec 24, 2019 Update Jan 20, 2020
build.gradle.kts Add buildSrc Dec 25, 2019 Rename library folder Dec 24, 2019
gradlew.bat Initial edge-to-edge implementation Dec 24, 2019

Maven Central License

🌖 Edge-to-Edge

In meanwhile, here is an Android library for enabling edge-to-edge content and insetting views using simple Kotlin DSL.

Getting Started

  1. Configure transparent colors of the status and navigation bars in res/values/styles.xml by extending a theme without the action bar like Theme.MaterialComponents.Light.NoActionBar or Theme.Design.Light.NoActionBar or similar.
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:windowTranslucentStatus">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
        <item name="android:statusBarColor">@color/statusBar</item>
        <item name="android:navigationBarColor">@color/navigationBar</item>
    <color name="statusBar">@android:color/transparent</color>
    <color name="navigationBar">@android:color/transparent</color>
  1. Remove android:fitSystemWindows attribute everywhere from layouts, if present.
  2. Fit top and bottom views of each fragment or activity as needed.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    edgeToEdge { { Edge.Left + Edge.Top + Edge.Right } { Edge.Bottom }

See sample app for more edge-to-edge examples.


repositories {
dependencies {
    implementation 'de.halfbit:edge-to-edge:<version>'


The library is implemented around WindowInsets class. Each time WindowInsets are dispatched through out the view hierarchy, the library fits views according to the declared fitting rules.

Edge-to-Edge library fits each view to one or more device edges by modifying its padding, margin or height attribute with the values taken from the current WindowInsets. Padding and margin attributes preserve their original values defined in layout and inset values are added to them. The library "auto-detects" the attrbitute to modify, which can be overridden by using fitPadding, fitMargin or fitHeight convenience functions.


  • Easiness of use - padding, margin or height can be adjusted to any edge with a single line of code.
  • Convenient default parameters for common elements like recycler view, scroll view, floating actions button etc.
  • Ability to remove fitting rules, which comes handy when working with transitions in ConstraintLayout.
  • Demo app with edge-to-edge examples (any kind of contribution is welcome).

Similar libraries


Copyright 2020 Sergej Shafarenka,

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.