Get status bar height dynamically from XML : <p>I need to optimize my Android app to look good on phones with a notch, like the Essential Phone.</p>

<p>This phones have different status bar heights than the standard 25dp value, so you can't hardcode that value.</p>

<p>The Android P developer preview released yesterday includes support for the notch and some APIs to query its location and bounds, but for my app I only need to be able to get the status bar height from XML, and not use a fixed value.</p>

<p>Unfortunately, I couldn't find any way to get that value from XML.</p>

<p>Is there any way?</p>

<p>Thank you.</p>
