Tem*_*Dev 19
TextColor只是用于将颜色设置为任何给定视图的文本的xml属性.
TextColorPrimary是启用按钮和大文本视图的默认文本颜色.
TextColorSecondary是中小文本视图的默认文本颜色.
忽略这一点,至于你想做什么,有一个更好的方法.您希望编辑style.xml,以便默认主题AppTheme(或您在清单中声明为主题的任何其他内容)包含必要的xml属性以自定义文本颜色.
完成后,生成的AppTheme样式将如下所示.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">#hexColorForTextViews</item>
<item name="android:buttonStyle">@style/myDefaultButton</item>
</style>
Run Code Online (Sandbox Code Playgroud)
textColor将为所有文本视图设置默认颜色.buttonStyle将为所有按钮引用所需的自定义样式.要使其工作,请将此样式标记添加到styles.xml文件中.
<style name="myDefaultButton">
<item name="android:textColor">#hexColorForButtons</item>
<!-- other stuff you want your buttons to inherit by default -->
</style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12819 次 |
| 最近记录: |