如何为整个应用程序的小部件设置 primary/accent 颜色?

How to Set primary/accent colors for widgets for entire application?

我的应用程序基本主题文件如下,其中我正在设置原色和强调色

    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/primary_yellow</item>
        <item name="colorPrimaryDark">@color/primary_yellow_dark</item>
        <item name="colorAccent">@color/accent</item>
        <item name="colorButtonNormal">@color/primary_orange</item>
</style>

然而,当我使用编辑文本和开关以及单选按钮时,当它被按下或当它的状态为 changed.All 我想要的是更改为在我的 styles.xml 中设置的原色。此外,由于我的目标设备大于 API16,我希望在所有设备上统一支持 API22

如有任何帮助,我们将不胜感激!

编辑

像这样为整个应用程序使用主题

<application
        android:allowBackup="true"
        android:icon="@drawable/launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:replace="android:theme,android:icon">

找到解决方案我创建了两个 styles.xml 文件,一个用于 API21 及更高版本,一个用于 API16 和 above.In 将这两行添加到基本主题中

<!--used for changing the focius colors of editext-->
 <item name="colorControlActivated">@color/primary_yellow</item>
 <item name="colorControlHighlight">@color/primary_yellow</item>