Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Jetpack Compose component(s) used: any (latest)
Android Studio Build: latest
Kotlin version: latest
Here's the default example of empty activity created with Jetpack Compose, just replaced a text with a button to show fullscreen ad (Admob Interstitial)
class MainActivity : ComponentActivity() {
private var interstitialAd: InterstitialAd? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ... load ad
enableEdgeToEdge()
setContent {
AppTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Column(
modifier = Modifier.padding(innerPadding)
) {
Button(onClick = {
interstitialAd?.show(this@MainActivity)
}) {
Text(
text = "Show fullscreen ad"
)
}
}
}
}
}
}
Before pressing the button the UI looks fine (as expected):
[![enter image description here][1]][1]
But when I click the button to show the ad the content of app's activity jumps under the status bar:
[![enter image description here][2]][2]
This is very annoying. I have this issue in my real projects where I also use Jetpack Compose.
We need to use `enableEdgeToEdge()` or `WindowCompat.setDecorFitsSystemWindows(window, false)` to be able to draw the backround for system bars with Jetpack Compose instead of Theme/Style xml.
The issue happens with any activity which appears above app's own activity, for example:
1) when a dialog with app chooser appears: `context.startActivity(Intent.createChooser(...))`
2) Google Play In App Review: `reviewManager.launchReviewFlow(activity, reviewInfo)`
and so on
[1]:
[2]: