EDIT: I just realised it isn't actually the accent color. I tried changing the accent color and while it changed everywhere else, the color of my nav items stayed pink. I just assumed it was the accent color because it was similar to it. Now I have no idea where that color is coming from.
I've just noticed that in my app the nav drawer items are the accent color instead of being black when running on Android 8.
In Android 7 they are still black it is only Android 8 that it is different for. Also when looking at the design preview in Android Studio it shows them as black for API 26 (Android 8) but when it runs it is the accent color.
Here are a few images demonstrating the issue:
This is what it looks like in the design preview in Android Studio and on versions before 8:
And on Android 8:
Note that the primary color still works when an item is active (which is how I want it) but if I try and change the tint of the icon or text to black it no longer is able to change to the primary color when active so that doesn't work as a work around.
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#F44336</color>
<color name="colorPrimaryDark">#D32F2F</color>
<color name="colorAccent">#FF4081</color>
</resources>
xml for nav activity
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main_nav"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main_nav"
app:menu="@menu/activity_main_nav_drawer" />
</android.support.v4.widget.DrawerLayout>
Does anyone have any idea why this might be happening?
Okay I managed to work it out. Turns out I was using dependencies for themes with api level 23 and they were breaking in Android 8. Managed to fix the issue by upgrading my dependencies, target SDK and compile SDK version to 26.
Got Solution - Navigation Drawer menu item Text color Pink issue in android 8.. I am also facing the same issue occurs in Oreo(MiA1).
*Change compile SDK version to 25.
compileSdkVersion 25
Update those libraries mention below(app.gradle)
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:palette-v7:25.3.0'
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