CoderAlee / PaintedSkin

一款解决Android App 换肤框架,极低的侵入性与学习成本。
Apache License 2.0
166 stars 23 forks source link

Tablayout自定义Tab设置Textview的颜色切换无效 #47

Closed HitaoLin closed 5 months ago

HitaoLin commented 5 months ago

通过TabLayout.setCustomView()设置Tab的自定义view,自定义view是使用xml实现,TextView的textColor是使用selector实现,在其他皮肤下也添加了selector文件和color,切换皮肤textColor没有切换。 1716261900301 1716261970968

CoderAlee commented 5 months ago

TabLayout.setCustomView()的参数是在代码中动态创建的么?

HitaoLin commented 5 months ago

通过inflate获取view后,tablayout.setCustomView(view)

CoderAlee commented 5 months ago

通过inflate获取view后,tablayout.setCustomView(view)

  1. 将Tab中TextView的textColor用在其他控件上确认是否能正确换肤。以排除是否为资源适配问题。
  2. 确认LayoutInflate.from(context) 得到的inflate.factory2的值是什么?
HitaoLin commented 5 months ago

1.使用上边的selector文件在其他控件也无法换肤(使用了button进行修改textcolor) 2.打印出来是:factory2 = org.alee.component.skin.factory2.ThemeSkinFactory2@ae1a16b

CoderAlee commented 5 months ago

1.使用上边的selector文件在其他控件也无法换肤(使用了button进行修改textcolor) 2.打印出来是:factory2 = org.alee.component.skin.factory2.ThemeSkinFactory2@ae1a16b

资源在其他控件上也无法换肤,说明资源适配有问题,检查一下对应的皮肤包下是否有同名selector

HitaoLin commented 5 months ago

有同名的selector,把selector移到res/color就可以了