In my case I used custom header items with icons. You can see details in this tutorial. For TextView from my layout I defined xml
file in the color
directory, something like this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/accent_color" android:state_selected="true"/>
<item android:color="@color/white"/>
</selector>
and the same xml files (but with android:drawable
attributes ) in the direcroty drawable
.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_focused"
android:state_selected="true"/>
<item android:drawable="@drawable/icon"/>
</selector>
Then simply set android:textColor="@color/your_new_xml_file"
for TextView
and use your drawable files for your header ImageView
.
If you need to change View
background, not only header icon and text color, set such xml
file with defined colors as a View
background.
OnSelectLevelChanged() method in my presenter class is empty (without this, like in tutorial above) :
holder.view.setAlpha(mUnselectedAlpha + holder.getSelectLevel() *
(1.0f - mUnselectedAlpha));