Naila Naila - 1 month ago 13
Android Question

Get full screen layout in Fragment

I have a main Activity, and I am loading Fragments inside it.

I do not want the ActionBar, so I have hidden it in Manifest as follows

android:theme="@style/NoActionBar"


When I populate a Fragment, the ActionBar is hidden, but it gives a black portion on the bottom of the screen and I can't even use that specific portion in my layout.

Any help?

Answer

Replace your style.xml with below code:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="AppTheme.NoActionBar"> 
        <item name="windowActionBar">false</item> 
        <item name="windowNoTitle">true</item> 
    </style>


</resources>

and then set theme as

android:theme="@style/AppTheme.NoActionBar"