Customize Android TabWidget from XML

Joshua Partogi picture Joshua Partogi · May 1, 2011 · Viewed 11.2k times · Source

I have been looking around on how to customize Android TabWidget using XML with no luck. All examples that I have found is showing how to customize TabWidget using Java code. Is it possible to customize [i.e change the background color, change the text color, etc] TabWidget using XML alone? If so, can you redirect me to a document on how to do it or possibly a code snippet?

Thanks

Answer

rekaszeru picture rekaszeru · May 1, 2011

You have to create your own styles, state- and layer drawables, and apply them to your TabWidget in the layout xml.

A working example can be found at this answer's update part, I hope it will help you work it out.