Android API 35: Fixing Status Bar and Navigation Bar Color Issues


When Android releases a new API level, developers often face subtle but frustrating UI bugs. With Android 14 (API Level 35), many developers reported that the AppBar (Toolbar) color, Status Bar color, and Navigation Bar color don’t behave consistently as they used to.
If your app suddenly shows:
Status bar turning black despite setting a color,
Navigation bar ignoring your theme colors, or
AppBar overlapping system bars,
👉 then this blog is for you.
What Changed in API 35?
Starting with Android 14, Google made changes to system UI visibility and theme overlay behavior. The status bar & navigation bar color handling now relies more strictly on:
WindowInsetsController instead of legacy flags.
Edge-to-edge rendering principles (apps are expected to draw behind system bars).
Dynamic theme enforcement (Material You colors may override your hardcoded values if not properly set).
Because of this, old code like:
window.statusBarColor = ContextCompat.getColor(this, R.color.primaryDark)
window.navigationBarColor = ContextCompat.getColor(this, R.color.primaryDark)
…may not behave consistently anymore on API 35+.
The Right Way to Handle It in API 35
To fix this, we now need to explicitly set system bar behavior using WindowInsetsControllerCompat
.
Here’s the correct approach:
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsControllerCompat
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Enable edge-to-edge
WindowCompat.setDecorFitsSystemWindows(window, false)
// Set status bar & navigation bar colors
window.statusBarColor = ContextCompat.getColor(this, R.color.my_status_bar_color)
window.navigationBarColor = ContextCompat.getColor(this, R.color.my_navigation_bar_color)
// Control light/dark icons
val insetsController = WindowInsetsControllerCompat(window, window.decorView)
insetsController.isAppearanceLightStatusBars = true // for dark text/icons
insetsController.isAppearanceLightNavigationBars = false // for light icons
}
}
✅ This ensures consistent colors across API 21 → 35+.
✅ Works with Material 3 themes as well.
✅ Allows you to opt-in to edge-to-edge design.
Common Pitfalls
Theme.xml not updated
Make sure you declare transparent system bar overlays in your theme if you’re using edge-to-edge:<style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar"> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar">true</item> </style>
Using
fitsSystemWindows
incorrectly
Don’t rely onandroid:fitsSystemWindows
in layouts anymore — it can break immersive UI on API 35. Instead, handle insets programmatically.Forgetting Dark Mode
Always test both light theme & dark theme, because system icons adapt differently.
Migration Checklist for API 35
✅ Replace
window.statusBarColor
calls withWindowInsetsControllerCompat
handling.✅ Use
WindowCompat.setDecorFitsSystemWindows(window, false)
for edge-to-edge rendering.✅ Test in both light and dark modes.
✅ Update your theme.xml with transparent system bar values.
✅ If you use Jetpack Compose → prefer
SystemUiController
from Accompanist.
Jetpack Compose Fix
If your project uses Jetpack Compose, you can fix it like this:
@Composable
fun MyAppTheme(content: @Composable () -> Unit) {
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colorScheme.isLight
SideEffect {
systemUiController.setStatusBarColor(
color = Color.Transparent,
darkIcons = useDarkIcons
)
systemUiController.setNavigationBarColor(
color = Color.Black,
darkIcons = !useDarkIcons
)
}
MaterialTheme(
colorScheme = myColorScheme,
content = content
)
}
Final Thoughts
Migrating to API 35+ means fully embracing edge-to-edge UI. Instead of fighting system bar colors, design your app to feel natural with them. The combination of WindowInsetsControllerCompat (Views) or Accompanist SystemUiController (Compose) is the future-proof way forward.
📌 Reference: Android Developers – Edge-to-edge guide
Subscribe to my newsletter
Read articles from sunil thakor directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

sunil thakor
sunil thakor
Mobile App Developer with 14+ years of experience crafting scalable apps for leading companies. Skilled in Android, React Native, and ReactJS, with a strong focus on creating seamless user experiences. Passionate about blending AI with smart development to deliver impactful, future-ready solutions. Result-driven, innovative, and always learning.