What exactly does fitsSystemWindows do?

后端 未结 3 809
我寻月下人不归
我寻月下人不归 2021-01-29 20:39

I\'m struggling to understand the concept of fitsSystemWindows as depending on the view it does different things. According to the official documentation it\'s a

3条回答
  •  Happy的楠姐
    2021-01-29 21:43

    System windows are the parts of the screen where the system is drawing either non-interactive (in the case of the status bar) or interactive (in the case of the navigation bar) content.

    Most of the time, your app won’t need to draw under the status bar or the navigation bar, but if you do: you need to make sure interactive elements (like buttons) aren’t hidden underneath them. That’s what the default behavior of the android:fitsSystemWindows=“true” attribute gives you: it sets the padding of the View to ensure the contents don’t overlay the system windows.

    https://medium.com/google-developers/why-would-i-want-to-fitssystemwindows-4e26d9ce1eec

提交回复
热议问题