调用时未应用样式

Style not applied when called

所以我是 android 的新手,这是我的问题: - 当我将样式调用到 textview 时它不会改变任何东西,这是我的 style.xml :

<?xml version="1.0" encoding="utf-8"?>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- App branding color for the app bar -->
    <item name="colorPrimary">#009688</item>
    <!-- Darker variant for the status bar and contextual app bars -->
    <item name="colorPrimaryDark">#00796B</item>
    <!-- Theme UI controls like checkboxes and text fields -->
    <item name="colorAccent">#536DFE</item>
</style>

<!-- Style for header text in the order form -->
<style name="HeaderTextStyle">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">48dp</item>
    <item name="android:gravity">center_vertical</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:textSize">15sp</item>
    <item name="android:textColor">#FF5252</item>
</style>

我是这样称呼这种风格的

    <TextView
    android:hint="@string/topping"
    style="@style/HeaderTextStyle"
    />

我尝试使用

仅更改文本视图的颜色
android:textColor="#FF5252"

但它什么也没做

有人可以帮助我吗,我将不胜感激, 提前致谢

您正在设置 textColor,而您还没有设置文本,您需要将 textColo 更改为 textColorHint,或者如果要使用 textColor,则将提示更改为文本,对于提示,您使用 textColorHint,对于文本,您使用 textColor,就像这样。

<TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="some text"
            android:textColor="@color/colorPrimaryNero"
            android:hint="some hint"
            android:textColorHint="@color/colorPrimaryWhite" />