应用样式后 SwitchMaterial 不会更改 textStyle

SwitchMaterial doesn't change textStyle after applying style

代码:

片段:

        <com.google.android.material.switchmaterial.SwitchMaterial
            android:id="@+id/changeDateFormatSwitch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="4dp"
            android:text="@string/timeFormat"
            android:theme="@style/switchText"
            app:layout_constraintEnd_toEndOf="@+id/timePicker"
            app:layout_constraintStart_toStartOf="@+id/timePicker"
            app:layout_constraintTop_toBottomOf="@+id/timePicker"
            app:switchTextAppearance="@style/switchText" />

主题:

(如您所见,我尝试了很多方法...但其中 none 已经奏效了...还没?)

  <style name="switchText">
        <item name="android:textColor">@color/gold</item>
        <item name="android:textColorPrimary">@color/gold</item>
        <item name="android:editTextColor">@color/gold</item>
        <item name="colorControlNormal">@color/gold</item>
        <item name="colorControlActivated">@color/gold</item>
    </style>

任何想法我应该改变什么来改变:

文字颜色?

提前致谢:)

您可以使用:

<com.google.android.material.switchmaterial.SwitchMaterial
    style="@style/Widget.App.CompoundButton.Switch"
    ../>

与:

<style name="Widget.App.CompoundButton.Switch" parent="@style/Widget.MaterialComponents.CompoundButton.Switch">
    <item name="android:textColor">@color/...</item>
</style>