2

I'm an android beginner. I did not want my app to have an action bar, so I disabled it.

However, other views are displayed after a blank padding, which is where the action bar previously was. Like

enter image description here

How can I have this space removed? I have tried:

  • setting the padding of the layout / margin of the views to 0.
  • Setting layout_gravity to top
Community
  • 1
  • 1
dsynkd
  • 1,999
  • 4
  • 26
  • 40

1 Answers1

5

Add this code in style.xml

 <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:actionBarSize">0dp</item>
</style>

and use this code in Activity theme in manifest.

<activity 
       android:name=".MainActivity"
       android:theme="@style/AppTheme.NoActionBar">
</activity>
dastan
  • 892
  • 10
  • 17