在Samsumg Galaxy Tab 4上忽略App Theme的TextColor

时间:2016-06-28 21:41:07

标签: android android-theme

我有一个Android应用程序,我在styles.xml的主题中设置了如下文本和背景颜色:

<style name="MyAppTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">#28abe3</item>
    <item name="colorPrimaryDark">#0f92ca</item>
    <item name="colorAccent">#0f92ca</item>
    <item name="android:textColor">#8a000000</item>
    <item name="android:textColorPrimary">#de000000</item>
    <item name="android:colorBackground">#fffafafa</item>
    <item name="android:textColorSecondary">#8a000000</item>
    <item name="android:textColorTertiary">#8a000000</item>
</style>

这对我可以找到的每个设备都很有效。但是,我有一些用户在三星Galaxy Tab 4上运行应用程序,他们报告说某些文本视图以非常浅的灰色显示文本,几乎与背景无法区分,而不是通过指定的深灰色主题。这不会影响应用程序中的每个TextView,但示例如下所示:

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text Here"
    android:id="@+id/problematicTextView"
    android:layout_weight="1"
    android:minHeight="25dp"
    style="@android:style/TextAppearance.DeviceDefault.Medium" />

我已经尝试了所有我能想到的东西,只需购买Galaxy Tab 4就可以通过反复试验调试,但无济于事。使用正确的深灰色文本而不是以浅灰色显示的TextView之间唯一的区别特征是:

style="@android:style/TextAppearance.DeviceDefault.Medium"

正常工作的有:

style="@android:style/TextAppearance.DeviceDefault.Small"

但据我了解,这只是为了影响文字大小而不是颜色。

我错过了以适用于所有设备的方式正确设置TextView文本颜色的方式(目标API级别16 +)?

1 个答案:

答案 0 :(得分:1)

如果您希望在所有设备上使用一致的主题,则应避免使用任何DeviceDefault样式,因为这些样式是由各个制造商定制的样式。

我建议使用其中一种AppCompat TextAppearance样式,例如Theme.AppCompat.Medium