Android: unwanted white box at the top of the screen (toolbar?)

How do I get rid of the white box at the top of my android? I don't see anywhere in my code where I was calling something that created the toolbar and I didn't code it myself. He also exists above the gaze, not in it. I'm guessing there is some tweak in the design view of the XML file that can toggle it? Thank you in advance!

** I should also include that it is only in this exercise and my other activities do not have this white bar at the top. Also, the action bar is a thin blue bar above the white car, so any code that involves manipulating the action bar will not change the status of the white bar. **

Android View with weird toolbar

EDIT: XML code below

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bucket"
    android:theme="@+id/BucketTheme2"
    android:backgroundTint="#70FFFFFF"
    android:backgroundTintMode="src_over">

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TableRow>
        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:paddingBottom="5dp"
            android:paddingTop="100dp"
            android:text="Find a place to go around you!"
            android:textColor="#ff000000"
            android:textSize="18dp" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:onClick="randomButtonPressed"
            android:text="RANDOMIZE"
            android:textSize="20dp" />
    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/bucketBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:onClick="bucketButtonPressed"
            android:text="Bucket List"
            android:textSize="20dp" />

    </TableRow>

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/searchLocationBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:onClick="searchButtonPressed"
            android:text="Search by Location"
            android:textSize="20dp" />

    </TableRow>

</TableLayout>

</RelativeLayout>

      

EDIT 2: The style.xml code for BucketTheme2 is below (I didn't post it originally because it only sets the colors):

<style name="BucketTheme2" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

      

+3


source to share


6 answers


Set a theme for the application or action in the Manifest.xml to remove the action bar:

android:theme="@android:style/Theme.Holo.Light.NoActionBar"

      



Or add the following code to Activity in onCreate method and import android.support.v7.app.ActionBar file:

ActionBar actionBar = getSupportActionBar();
actionBar.hide();

      

+4


source


Add the following topic tostyle.xml

 <style name="AppTheme.NoActionBar">
      <item name="windowActionBar">false</item>
      <item name="windowNoTitle">true</item>
 </style>

      

Then set this theme to action in manifest

:

  <activity
      android:name=".MainActivity"
      android:theme="@style/AppTheme.NoActionBar"/>

      



UPDATE: You can also set a theme like below:

<style name="BucketTheme2" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

      

Hope it helps.

+4


source


Add NoActionBar style to style.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">false</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

      

And add this topic to your activity from the manifest,

<activity android:name=".YourActivity"
        android:theme="@style/AppTheme"
        >
    </activity>

      

+2


source


Change your activity theme in manifest to Theme.AppCompat.Light.NoActionBar

and you should be sorted

+2


source


try

 requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main);

      

it must be before setContentView

+1


source


Just try this your way

<style name="BucketTheme2" parent="android:Theme.Holo.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

      

+1


source







All Articles