I used Androids "Bottom Navigation Activity"-example but in every fragment, I have a blank toolbar at the top of the fragment (white bar at the top of the screen in screenshot). I already applied NoActionBar in the Manifest file and also in the layout preview, I can't see a Toolbar. How can I remove the toolbar at the top of each fragment?
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.myapp.test">
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Quizeule">
<activity android:name=".activities.PlayActivity" />
<activity android:name=".activities.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.LoginActivity" />
<activity android:name=".MainActivity" />
</application>
</manifest>
Themes.xml:
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Quizeule" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

Try this :
İf you use java ; write in fragment onCreate:
GetActivity.getSupportedActionBar.hide();
Or ,
// set Windows Flags to Full Screen
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Or if you use kotlin ; write in onCreateview:
(activity as AppCompatActivity).supportActionBar!!.hide()}
Or
requiredActivity.supportActionBar!!.hide()
In activity_main.xml remove android:paddingTop="?actionBarSize" and that will fix the error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With