Android Question Add dynamic top padding using the real status bar/cutout inset, not a fixed value.

aedwall

Active Member
Licensed User
Longtime User
Apparently some phones now have a status bar that is greater in height than in other phones. My current app sets a row of 6 buttons at a TOP property setting of 3. But with some or newer phones their status bar overlays my buttons so a user can't read the button captions. So how do I make my top buttons have a dynamic setting as to their TOP property so that each phone adjusts accordingly and button captions are fully exposed and readable? Thank you.
 

aeric

Expert
Licensed User
Longtime User
Might be related to edge to edge in new versions of Android.
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
Might be related to edge to edge in new versions of Android.
Preliminary tests seem to show that the below fixes the issue on the single phone in question:

Manifest file:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="35"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values-v20, theme.xml,
<resources>
    <style
        name="LightTheme" parent="@android:style/Theme.Material.Light">
                [B]<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>[/B]
    </style>
</resources>
)
 
Upvote 0
Top