Changing font color only shows up in design view, not app

I have successfully changed the font color of the Crime_Title so that it is black.
It shows up as expected in the design view as black (instead of grey).
crimeTitleBlackFont

However, when I run the app, the title still looks grey.
crimeTitleBlackFont2

I’ve seen this kind of behavior in the past in other apps I’ve built and I’m wondering why this might be occurring.
I’m running on a API 25 (Nougat) emulator.
You can see the font color is referenced in the XML layout:
<TextView
android:id="@+id/crime_title"
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_marginRight=“5dp”
tools:layout_editor_absoluteX=“0dp”
tools:text=“crime_title is here”
tools:textColor="@android:color/black" />

EDIT - SOLVED

I just looked more closely at that line that sets the textColor – It has the tools: namespace prefix so it only sets it in the designer. I just made the change and added
android:textColor="@android:color/black"

That fixed it.

However, I’m not sure why changing the value using the Design view window set the tools: version instead of the android: one.

Wow. That is weird. Anything with the tools namespace is stripped out at compile time and only used by the preview. It is so strange that the tools would set tools:textColor.

Thanks for posting your solution.

1 Like