I used astuetz library and implemented PagerSlidingTabStrip for my android application, it's working find. Now I want to change pressing effect, I tried:
android:background="@drawable/tab_selecor"
Code for tab selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/darkGreen" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@color/darkGreen" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@color/green" />
</selector>
The press colour suppose to be changed to dark green but as you see it does not change, it still looks like this even if I use another colour like red, yellow, .... .
Make use of setIndicatorColor() for setting the color of indicator and setIndicatorHeight() for setting the height
And make use of setTabBackground() method to set the background to tab
Use this drawable for tab background
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Active tab -->
<item
android:state_selected="true"
android:state_focused="false"
android:state_pressed="false"
android:drawable="@color/red" /> <!-- Inactive tab -->
<item
android:state_selected="false"
android:state_focused="false"
android:state_pressed="false"
android:drawable="@android:color/black" />
<!-- Pressed tab -->
<item
android:state_pressed="true"
android:drawable="@android:color/transparent" />
<!-- Selected tab (using d-pad) -->
<item
android:state_focused="true"
android:state_selected="true"
android:state_pressed="false"
android:drawable="@android:color/transparent" />
</selector>