2

I want to change the default blue color of this theme to my custom color. As you can see the ListView Color is blue. Same goes for AlertDialogs and other built in features. I want to change this default blue color to my own color.

enter image description here

Update my 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>

Image enter image description here

Tushar Narang
  • 1,997
  • 3
  • 21
  • 49

3 Answers3

2

In your styles.xml in values folder you should define the following colors:

<style name="Theme.default" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">@color/grey_07</item>
    <item name="colorPrimaryDark">@color/grey_15</item>
    <item name="colorAccent">@color/color_accent</item>
</style>

enter image description here

Tushar Narang
  • 1,997
  • 3
  • 21
  • 49
Thomas R.
  • 7,988
  • 3
  • 30
  • 39
1

You need to set a listSelector on your listview:

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

But it is better to define a state drawable.

Thomas R.
  • 7,988
  • 3
  • 30
  • 39
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>
sasikumar
  • 12,540
  • 3
  • 28
  • 48