# Insetter **Repository Path**: liu_wanshun/Insetter ## Basic Information - **Project Name**: Insetter - **Description**: 一个完全无侵入、简单易用的处理 WindowInsets 的库。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-02-18 - **Last Updated**: 2022-05-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: Android ## README # Insetter [![](https://jitpack.io/v/com.gitee.liu_wanshun/Insetter.svg)](https://jitpack.io/#com.gitee.liu_wanshun/Insetter) 一个完全无侵入、简单易用的处理 [WindowInsets](https://developer.android.com/reference/android/view/WindowInsets.html) 的库。 ## Gradle **1.** 引入jitpack仓库 ```kotlin repositories { maven { name = "jitpack" url = uri("https://jitpack.io") } } ``` **2.** 添加依赖 ```kotlin dependencies { implementation ("com.gitee.liu_wanshun:Insetter:0.0.1") } ``` ## 用法 **1.** 在布局文件中添加以下属性即可,无需任何代码,这些属性完全来自于[Material组件库](https://github.com/material-components/material-components-android),所以这个Insetter库可以做到完全无侵入。 - `app:paddingLeftSystemWindowInsets`: 将[system window insets](https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.html#getSystemWindowInsets()) 的 left 应用于视图的`paddingLeft`. - `app:paddingTopSystemWindowInsets`:将[system window insets](https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.html#getSystemWindowInsets()) 的 top 应用于视图的`paddingTop`. - `app:paddingRightSystemWindowInsets`: 将[system window insets](https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.html#getSystemWindowInsets()) 的 right 应用于视图的`paddingRight`. - `app:paddingBottomSystemWindowInsets`:将[system window insets](https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.html#getSystemWindowInsets()) 的 bottom 应用于视图的`paddingBottom`. 例如: ```xml