I want to change the default color (blue) of a selected item in a Navigation Drawer in Android. I have gotten it to work in past projects, but I cannot in the project I am currently working on.
This is the app theme.
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">@style/AppTheme.ActionBar</item>
<item name="android:activatedBackgroundIndicator">@drawable/activated_background</item>
<item name="android:buttonStyle">@style/AppTheme.Button</item>
</style>
This is the activated_background drawable.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@drawable/list_selected"/>
<item android:state_selected="true" android:drawable="@drawable/list_selected"/>
<item android:state_pressed="true" android:drawable="@drawable/list_selected"/>
</selector>
Finally, this is the navigation drawer fragment.
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#cccc"
tools:context=".NavigationDrawerFragment" />
Like I said, this has worked for me before. The only difference between projects that I can think of is that before, my app theme was inherited from "Theme.AppCompat" and this project's theme is inherited from "android:Theme.Holo.Light.DarkActionBar". Also, I am using v4 support fragments in my new project, while as in the other project I was just using the standard fragment.
Any advice would be greatly appreciated. Thanks.