Learning Android Development

Android Jetpack Compose: Inset Padding Made Easy

Make Learning Jetpack Compose Easier

Photo by pine watt on Unsplash

In a typical Android App, other than the app content, there are other visible elements on shown top of the app, as shown in the picture below. They are called Insets.

Sometimes we want to expand our app content’s view into these insets area, or we want to pad our view not to be blocked by the keyboard, how can we do so?

To do it ourselves manually is difficult. You can know why it is difficult by check out this presentation by Chris Banes. Fortunately enough, he also provide us libraries to easier handle it, even for Jetpack Compose, i.e https://github.com/google/accompanist/tree/main/insets

Let’s explore further

To understand how to use it, I create a simple Jetpack Compose App below. Here you see the Status Bar and Navigation Bar used us some real-estate of the mobile phone.

--

--