Constraint view elements to not be covered by the android system bars (status bar, navigation bar, etc) with XML ONLY, no ANY CODE needed
There're several views provided in the library:
Constraint other child views in the same ConstraintLayout parent to this SafeAreaView view so those views will not be covered by the System UI. By using this view, you can handle almost the common ui layout types.
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.dtrung98.insetsview.SafeAreaView
android:id="@+id/safeArea"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/wallImageView"
android:layout_width="0dp"
android:layout_height="350dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/content"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@+id/safeArea"
app:layout_constraintEnd_toEndOf="@+id/safeArea"
app:layout_constraintTop_toTopOf="@+id/safeArea"
app:layout_constraintBot_toBotOf="@+id/safeArea"/>
...
</androidx.constraintlayout.widget.ConstraintLayout
implementation 'com.github.ldt-libs:InsetsView:1.0'