From API 29 or Android 10, Android introduced a feature for Display cutouts on the screen (for camera for example).

These are call Insets and can be accessed via DisplayCutout object. In this example is described how to get the size of this cutouts:

We must at least target API level 29 and above. Also keep in mind that if you want to get the values from DisplayCutout object, the root view (for activity or fragment) needs to be rendered (or lay out) on screen:

 

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *