Android textview颜色无故改变
Android textview color change without any reason
今天我在 android 4.1 的设备上使用我的应用程序,我发现了一个非常烦人的错误。
每次我刷新屏幕时,textview 都会无缘无故地改变它们的颜色(例如:恢复片段)。
在这个屏幕上所有的文字都是黑色的,但是在这里它们都是白色的。
有时有些是黑色的,有些是白色的。
这是我的应用程序中的通用文本视图声明。
<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" />
这是我第一次在我的应用程序中看到这个错误。
编辑 1:
Fragment fragment = new Fragment_Overview();
fragmentManager.beginTransaction().add(R.id.fragment_container_1, fragment, "root").commit();
将此行添加到 "values" 中的文件 "strings.xml" --> "res" 文件夹:
<color name="black">#000000</color>
并将下一行添加到您的 TextView 定义中:
android:textColor="@color/black"
今天我在 android 4.1 的设备上使用我的应用程序,我发现了一个非常烦人的错误。
每次我刷新屏幕时,textview 都会无缘无故地改变它们的颜色(例如:恢复片段)。
在这个屏幕上所有的文字都是黑色的,但是在这里它们都是白色的。 有时有些是黑色的,有些是白色的。
这是我的应用程序中的通用文本视图声明。
<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" />
这是我第一次在我的应用程序中看到这个错误。
编辑 1:
Fragment fragment = new Fragment_Overview();
fragmentManager.beginTransaction().add(R.id.fragment_container_1, fragment, "root").commit();
将此行添加到 "values" 中的文件 "strings.xml" --> "res" 文件夹:
<color name="black">#000000</color>
并将下一行添加到您的 TextView 定义中:
android:textColor="@color/black"