I'm trying to create a splashcreen for my android application. I'm using an AppCompat theme, and I read that to have it fullscreen, I have to use in my style.xml theme (which I did):
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
With that, my application starts in fullscreen in the sense that when it starts, there is a white screen (in fullscreen) that appears before my splashscreen.
However, when my splashscreen starts, there is a black bar on top (which is where the status bar is) (cf screenshot)
My splashscreen is pretty simple:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cardview_shadow_end_color"
tools:context=".ui.activity.SplashscreenActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_logo_galagomusic"
android:scaleType="centerCrop"
android:layout_centerInParent="true"/>
</RelativeLayout>
I tried to add in the splashscreen activity:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.decorView.apply {
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
}
supportActionBar?.hide()
setContentView(R.layout.activity_splashscreen)
}
But it still doesn't work.
I'm not sure what is going on here, if anybody can help, that would be great.
Thanks.
Edit: It seems to be related to this issue: How to remove top status bar black background
This issue come from the phone itself, which allow or not some application to go fullscreen.
https://www.gottabemobile.com/how-to-enable-full-screen-apps-on-galaxy-s10/
Is there a way to override that?