Blodhgard
Blodhgard

Reputation: 9385

Android textview color change without any reason

Today I used my app on a device with android 4.1 and I found a really annoying bug.

Without any reason the textviewschanged their color every time Irefreshed the screen(e.g.: resume a fragment).

enter image description here

In this screen all texts are black but here they are all white. Other times some are black, other are white.

This is a general textview declaration in my app.

<TextView           
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:text="@string/overview"
        android:textStyle="bold"
        android:textAllCaps="true" />

This is the first time that I've seen this bug on my app.

EDIT 1:

Fragment fragment = new Fragment_Overview();                    
        fragmentManager.beginTransaction().add(R.id.fragment_container_1, fragment, "root").commit();

Upvotes: 1

Views: 139

Answers (1)

MorZa
MorZa

Reputation: 2325

Add this line to the file "strings.xml" in "values" --> "res" folder:

<color name="black">#000000</color>

and add the next line to your TextView definition:

android:textColor="@color/black"

Upvotes: 1

Related Questions