Finally, I was able to remove the header space. As it turned out, including this tag
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
in the application in the manifest, made the application full-screen and fixed the problem. But I wanted the status bar to appear in my application. Therefore, I had to compromise the status bar in versions of Android in which the header space was not reduced, and let it be the same in other versions. So, here is how I resolved it.
in the manifest, I saved the code as it is
android:theme="@android:style/Theme.Light.NoTitleBar"
to remove the title bar in the application
and in the action that used the custom line layout, I checked the version of Android and kept the full-screen mode of the application on versions smaller and equal to Gingerbread.
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); }
lil'ms
source share