Exploring Edge to Edge Feature in Android Q
With Andorid Q coming, Android offers user to have a Edge to Edge experience to their Favourite app and it doesn't mean you have have a hidden navigation panel or to hide the status bar. Isn't it awesome ? So, let's take a dive in it .
But, first What is Edge to Edge to App?
Edge to Edge app is like your app occupying the full height including Navigation and Status Area from top screen edge to bottom screen edge. To understand it better, think it as having your status and navigation panel a transparent background.
Let's understand how we can do it in out app,
Step 01
Your app should be targetting Android Q, so your target version will look like,
targetSdkVersion 'Q'
Step 02
To make status and navigation bar transparent we use,
<style name="AppTheme" parent="...">
<item name="android:navigationBarColor">@android:color/transparent</item>
<!-- Optional, but recommended for full edge-to-edge rendering -->
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
and to set is via your activity file use,
Window.setNavigationBarColor()
and
Window.setStatusBarColor()
Step 03
Now, last but we need to tell the Android System, that the view layout is good enought to handle the Edge to Edge View. To, do that we will use,
view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULL_SCREEN)
where,
1. SYSTEM_IU_FLAG_LAYOUT_FULL_SCREEN : This flag is useful for making the App full screen from top to bottom.
2. SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : This is put the translucent Navigation bar on top of the App
3. SYSTEM_UI_FLAG_LAYOUT_STABLE : This is useful for providing Stable View to the app.
That is pretty much it how can you create app to use the Edge to Edge app feature.
Happy learning
Team MindOrks :)