tab_background.xml
tab_background_selected.xml:
tab_background_unselected.xml
上面的tab_background.xml中写了tab的选中与不选中是的两种状态;分别设置不同的颜色就行。
最好需要新建一个tablayout的style:
@drawable/tab_background #ff00ff 2dp
这个style你要单独的去命名,我的名字叫张继群就随便的命名了。在你的style中有tablayout单独的style;名称如下:
Base.Widget.Design.TabLayout 这个style很特殊。专门为tablayout准备。
这样就完成了。