I want to make my activity full screen with status bar on top of it like this picture:
I have used this code in manifest
inside activity
If you dont want your "Translucent navigation" transparent, here is the code to just make transparent the status bar
In your theme:
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowTranslucentStatus">true</item>
In your activity onCreate:
Window window = getWindow();
WindowManager.LayoutParams winParams = window.getAttributes();
winParams.flags &= ~WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
window.setAttributes(winParams);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
In Kotlin just use following code in your activity, also add android:fitsSystemWindows="true" in your parent view of activity.xml layout file. This will also show content over navigation bar too, provided you declared full screen style in your style.xml
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)
}