This is in the design interface.
This is the emulator.
The blue bar comes out of nowhere. I tried something like NoTitleBar, and the app just crashes. Someone help me Please!
Update my question. The extending to Activity does not work.
This is in the design interface.
This is the emulator.
The blue bar comes out of nowhere. I tried something like NoTitleBar, and the app just crashes. Someone help me Please!
Update my question. The extending to Activity does not work.
Extend just Activity
instead of AppCompatActivity
in your Java class and the toolbar would be gone.
And remove the code referencing toolbar from onCreate()
(if any was generated) and anywhere else (if you manually added) after changing the extended class, else you may see errors.
change your theme
in styles.xml
to Theme.AppCompat.Light.NoActionBar
no extra code needed!
Firstly open the activity_main.xml then there will be somecode like this one
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
delete the above code from activity_main.xml
Now open the MainActivity.java and delete the below code
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
after this your problem should be solved.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowNoTitle">true</item>
</style>
make sure you are not using getActionbar()
or getSupportedActionbar
in any activity that using this theme otherwise you will get NullPointerException
If any of the above doesn't work then, create a new style in your Style.xml file
<style name="AppTheme.NoActionBar" >
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
And in AndroidManifest.xml file, set your activity theme to the one you create :
<activity
android:name=".Example"
android:label="Example"
android:theme="@style/AppTheme.NoActionBar"/>
Well i had the same issue some time ago, and hiding it dynamically through code was the only solution that worked. In the onCreate() method do the following:-
getSupportActionBar().hide();
This will definitely work.
use theme with actionbar like Theme.AppCompat.Light.DarkActionBar
and in your activity use getSupportActionbar().hide();
in onCreate
before setContentView()