Android:API 19:更改默认的蓝色" Theme.AppCompat.Light"

时间:2015-08-13 07:17:55

标签: android

我想将此主题的默认蓝色更改为我的自定义颜色。 如您所见,ListView颜色为蓝色。 AlertDialogs和其他内置功能也是如此。我想将此默认蓝色更改为我自己的颜色。

enter image description here

更新我的style.xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="colorPrimary">@color/DarkYellow</item>

       <item name="colorPrimaryDark">@color/DarkYellow</item>
</style>

图片 enter image description here

3 个答案:

答案 0 :(得分:2)

在values文件夹的values.xml中,您应该定义以下颜色:

 byte[] hexBytes = new org.apache.commons.codec.binary.Hex().encode(mac.doFinal(data.getBytes()));

enter image description here

答案 1 :(得分:1)

您需要在列表视图上设置listSelector:

<item name="android:listSelector">@color/yourColor</item>

但最好定义一个可绘制的状态。

答案 2 :(得分:0)

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
<!-- Set AppCompat’s color theming attrs -->
<item name="colorPrimary">@color/my_color</item>
<item name="colorPrimaryDark">@color/my_darkercolor</item>

</style>
相关问题