Controlling the position of elements using insets

26 Views Asked by At

I am creating an application, the main activity of which is BottomNavigationView and FragmentContainerView with NavHost. I want to implement a behavior where when the keyboard is opened, the BottomNavigationView will remain in its place, and a padding equal to the height of the keyboard minus the height of the BottomNavigationView will be added to the FragmentContainerView from below. How do I achieve this?

I tried using setOnApplyWindowInsetsListener on the root element of the screen to pass information to the child views that I used an inset equal to the height of the BottomNavigationView. However, I do not understand in what form setOnApplyWindowInsetsListener should return this information.

I also use fragments in NavHost on which I use jetpack compose. I would like to use Modifier.imePadding() in my composable function to create indents.

Should I return a new insets created with the help of the builder, in which I will pass information about the type of inset and the used inset itself? Or should I transfer the inset that I received in the callback and somehow subtract the used values from it before returning this inset?

enter image description here

0

There are 0 best solutions below