I actually want to change the blue strips above and change them to red.
This question is really bothering me for too long. Before referring to this article from Google:
Https://developer.android.com/training/basics/actionbar/styling.html
But it backfired, I found that even my entire tab color changed.
It's strange, why is Google giving the method to modify the entire tab? Is Google mistaken?
On the internet for a long time, found a lot of people are asking this question, and the actual solution of the few people. Occasionally, there are several solutions, and that's the way Google is used. But mine is not right!
This problem has been placed. In the middle of a few attempts, no. Search today, find an article, I have a general look, or the use of Google's method, but he came with the source, some questions, why his color can be modified? Download his source code to run a look at the effect. I found it. Why is this? In the end, the mystery lies in the image he uses, which is transparent above, with color underneath. I used to have all the colors on top and bottom, so I would cover the whole tab.
This is the picture:
Oh, finally found the reason.
The following is the specific process: This process gives the Google article has.
First, modify the system styles.xml.V14 above version in the Values-v14 folder:
<style Name= "Appbasetheme" parent= "Android:Theme.Holo.Light.DarkActionBar" > <!--API + Theme customizations can go Here. --<item name= "Android:actionbarstyle" > @style/my_actionbar_style</item> <item name= "and Roid:actionoverflowbuttonstyle "> @style/mycustomtheme.overflow</item> <!--It's work---<item Nam E= "Android:homeasupindicator" > @drawable/upcaret</item> <!--it ' s work--><!--<item name= "a Ndroid:actionbuttonstyle "> @style/my_actionbar_tabbar_style</item>--<!--set Actionbar tab style, such as the following Red Guide, gap between tabs, etc.-<item name= "Android:actionbartabstyle" > @style/mytabview</item> <!-- Set the style of the Actionbar tab font-<!--<item name= "Android:actionbartabtextstyle" > @style/mytabtext</item> --</style>
<style name= "Mytabview" parent= "@android: Style/widget.holo.light.actionbar.tabview" > <item name= " Android:background "> @drawable/tab_indicator</item> <item name=" Android:paddingleft ">8dip< /item> <item name= "android:paddingright" >8dip</item> </style>
Second, under Res drawable folder (if not, create one yourself) Create a tab_indicator.xml:
<selector xmlns:android= "Http://schemas.android.com/apk/res/android" > <item android:state_selected= "False" android:state_pressed= "false" android:drawable= "@android: Color/transparent"/> <item android: State_selected= "false" android:state_pressed= "true" android:drawable= "@android: Color/transparent"/> < Item android:state_selected= "True" android:state_pressed= "false" android:drawable= "@drawable/base_tabpager_ Indicator_selected "/> <item android:state_selected=" true " android:state_pressed=" true "Android: drawable= "@drawable/base_tabpager_indicator_selected"/></selector>
As for the artifact of that drawable picture I uploaded a copy, everyone can base on this change color and modify the height. Address: Http://pan.baidu.com/s/1ozNKM
Final effect:
Reference:
https://developer.android.com/training/basics/actionbar/styling.html
http://blog.csdn.net/ xiaanming/article/details/9971721