0

I got so many answers when i searched about to make an activity full screen i tried many codes but my toolbar became white color (i am not sure the color *there in the screenshot ) as in the screenshot please help me to fix this , through java also i tried by seeing this thread from stack

In style i made

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>

And in manifest i made

<activity android:name=".colleges"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.Fullscreen"/>

Screenshot of what i got after making fullscreen

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Jaison
  • 5
  • 4

3 Answers3

0

If you have added a toolbar then you have to hide it too.

For hiding statusbar here's code:(boxRoot is your root layout from XML)

boxRoot.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
    | View.SYSTEM_UI_FLAG_FULLSCREEN
    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Raghav Satyadev
  • 728
  • 2
  • 11
  • 38
0

put this below code on your on create method before setContentView()

requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Haresh Ramani
  • 390
  • 1
  • 16
0

Update your style with this:

<style name="AppThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowTranslucentStatus">true</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
</style>

Then change your app theme:

<application
   ...
   android:theme="@style/AppThemeFullScreen"
   ...

or change single activity theme:

<activity
    android:name=".DummyActivity"
    android:theme="@style/AppThemeFullScreen" />

And I think your problem causes because of you are using "android:windowNoTitle". Don't use that use this:

<item name="windowNoTitle">true</item>
Özgür
  • 71
  • 7