目前,默认情况下我所有的文本和提示颜色都是白色的,虽然我可以在xml
文件中更改它们时可以,但某些内容(例如TextInputLayout
文本计数器)不允许更改颜色
下面是我的 colors.xml
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#5CCDCC</color>
下面是我的 styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/GreenishBlue</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowLightStatusBar">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
AndroidManifest
被修改成这样:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomTheme">
该文件res/values/styles.xml
如下所示:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColor">#000</item> //black color for text
<item name="android:textColorHint">#939393</item> //Gray color for hint
</style>
</resources>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句