There is this bar at the bottom of my navigation drawer whenever I open it. Here is the image of what it looks like.
At first my whole layout was like that but then I removed android:fitsSystemWindows="true" which fixed the layout. However, that bar still remained at the bottom of my navigation drawer. How do I remove it?
I will also be leaving me code here:
Here is the activity.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Location.Location"
tools:openDrawer="right"
android:id="@ id/drawer_layout">
<com.google.android.material.navigation.NavigationView
android:id="@ id/drawerNavigationView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
app:headerLayout="@layout/navigation_drawer_header"
app:menu="@menu/navigation_drawer_menu"
android:fitsSystemWindows="true"
android:background="#FFFFFF"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@ id/backButton"
android:layout_width="10.08dp"
android:layout_height="17.63dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="334.9dp"
android:layout_marginBottom="763.6dp"
android:layout_marginTop="30.8dp"
android:src="@drawable/back_arrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@ id/hamburgerMenuIcon"
android:layout_width="27.01dp"
android:layout_height="23.53dp"
android:layout_marginStart="309.3dp"
android:layout_marginEnd="38.7dp"
android:layout_marginBottom="760.6dp"
android:layout_marginTop="27.8dp"
android:src="@drawable/icon_hamburger_menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@ id/textView9"
android:layout_width="130dp"
android:layout_height="17dp"
android:layout_marginStart="133dp"
android:layout_marginTop="79dp"
android:layout_marginEnd="112dp"
android:layout_marginBottom="716dp"
android:fontFamily="@font/century_gothic_bold"
android:text="SELECT LOCATION"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@ id/locationRecyclerView"
android:layout_width="250dp"
android:layout_height="280dp"
android:layout_marginStart="95dp"
android:layout_marginTop="173dp"
android:layout_marginEnd="75dp"
android:layout_marginBottom="353dp"
android:scrollbarSize="5dp"
android:scrollbarThumbVertical="@color/greyScrollBar"
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
android:scrollbarFadeDuration="0"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@ id/imageView"
android:layout_width="754.86dp"
android:layout_height="399.99dp"
android:layout_marginStart="310dp"
android:layout_marginTop="530dp"
android:layout_marginEnd="84dp"
android:src="@drawable/city_background"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.drawerlayout.widget.DrawerLayout>
Here is my menu.xml for my NavigationDrawer
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">
<group android:checkableBehavior="single">
<item
android:id="@ id/homeNavigationDrawer"
android:title="Home"
android:icon="@drawable/icon_home"
/>
<item
android:id="@ id/profileNavigationDrawer"
android:title="Profile"
android:icon="@drawable/icon_profile"
/>
<item
android:id="@ id/changeCityNavigationDrawer"
android:title="Change City"
android:icon="@drawable/icon_change_city"
/>
<item
android:id="@ id/emergencyCallNavigationDrawer"
android:title="Emergency Call"
android:icon="@drawable/icon_emergency_call_red"
/>
<item
android:id="@ id/loginAsGuestNavigationDrawer"
android:title="Log in as guest"
android:icon="@drawable/icon_login"
/>
<item
android:id="@ id/logoutNavigationDrawer"
android:title="Log out"
android:icon="@drawable/icon_logout"
/>
</group>
</menu>
To add here is the themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Flash" 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. -->
<item name="navigationViewStyle">@style/Widget.App.NavigationView</item>
</style>
<style name="Theme.Flash.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="ThemeOverlay.App.NavigationView" parent="">
<item name="colorSurface">@color/navigationViewBackground</item>
</style>
<style name="Widget.App.NavigationView" parent="Widget.MaterialComponents.NavigationView">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.NavigationView</item>
</style>
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
</style>
<style name="Theme.Flash.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Flash.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Here is my manifest.xml content
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Flash" >
<activity android:name=".MakatiCity.EmergencyCall" />
<activity android:name=".MakatiCity.Help" />
<activity android:name=".MakatiCity.Contact" />
<activity android:name=".MakatiCity.Profile" />
<activity android:name=".MakatiCity.OtherActivity" />
<activity android:name=".MakatiCity.ReportActivity" />
<activity android:name=".MakatiCity.TrackActivity" />
<activity android:name=".Landing.LandingPage" />
<activity android:name=".Home.SplashScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Location.Location" />
<activity android:name=".Register.Register" />
<activity android:name=".Login.Login" />
<activity android:name=".NCR.NCR" />
</application>
</manifest>
I just can't seem to figure out what is wrong with the code and why does it have that there. I already removed the **strong text android:fitsSystemWindows="true" but the NavigationDrawer didn't change at all. What can I do to resolve this?
Here is the Updated Version of it with implemented Themes
CodePudding user response:
NavigationView
inherits its background color from colorSurface
attribute of your app's theme. So, you can either update colorSurface
attribute of your theme in styles.xml
or you can change colorSurface
for your NavigationView
only.
For changing colorSurface
for only Navigation view.
<style name="ThemeOverlay.App.NavigationView" parent="">
<item name="colorSurface">@color/navigationViewBackground</item>
</style>
Create another theme style to override materialThemeOverlay
using above colorSurface
attribute.
<style name="Widget.App.NavigationView" parent="Widget.MaterialComponents.NavigationView">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.NavigationView</item>
</style>
Set this style to navigationViewStyle
attribute of your app theme
<style name="Theme.Flash" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="navigationViewStyle">@style/Widget.App.NavigationView</item>
</style>
CodePudding user response:
write short code in on create method
getSupportActionBar().hide();
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);
}