简化 TabLayout 使用,包含文本和图标的 customView 代替 TabLayout.TabView
- 支持远程动态加载图标
- 支持在 xml 中设置多个文本属性,支持在 AS 中预览
- 大小 tabTextSize/tabSelectedTextSize
- 字体 tabTextFont/tabSelectedTextFont
- 样式 tabTextStyle/tabSelectedTextStyle
repositories {
maven { url "https://gitee.com/ezy/repo/raw/cosmo/"}
}
dependencies {
implementation "me.reezy.cosmo:tablayout:0.10.0"
}
TabLayout.TabView 的字体大小只在 app:tabTextAppearance 中设置,就算获取到TabView里的TextView也无法改变字体大小
想要动态改变字体大小只能使用 customView
使用 customView 后 tabTextAppearance, tabTextColor, tabSelectedTextColor
都失效了
使用 customView 后 badge
失效
tabPadding*
不是添加在customView
上的边距,对手动在customView
添加的badge
有影响tabPadding
只能设置垂直方向的边距,对水平方向的空白无效tabPaddingStart, tabPaddingEnd
可设置水平方向边距,有默认值
// 这行代码是无效的,还是之前的颜色
tabs.setSelectedTabIndicatorColor(Color.TRANSPARENT)
The Component is open-sourced software licensed under the Apache license.