Closed Joslyn-Chen closed 3 years ago
首先库是好库,根据属性大全用xml配置也没问题。 现在我用一个类继承DslTabLayout,然后在init里面初始化一些配置。 1、角标配置失败。(onTabBadgeConfig配置也不生效,wiki里面好像是单一配置,统一配置不行,希望像xml配置一次就行了)
drawBadge = true tabBadge = DslTabBadge().apply { updateBadgeConfig( TabBadgeConfig( badgeTextSize = 10 * dp, badgeTextColor = Color.WHITE, badgeSolidColor = context.getCompatColor(color.user_badge_color), badgeGravity = Gravity.RIGHT or Gravity.TOP, badgeCircleOffsetX = 6 * dpi, badgeCircleOffsetY = 8 * dpi, badgeOffsetX = 8 * dpi, badgeOffsetY = 18 * dpi ) ) }
2、Indicator需要配置两次才能生效。(比如高宽和Offset,是因为他们的默认值不是本身?)
drawIndicator = true tabIndicator = DslTabIndicator(this).apply { indicatorHeight = 2 * dpi indicatorWidth = 40 * dpi indicatorHeightOffset = 1 * dpi indicatorYOffset = -1 * dpi indicatorStyle = DslTabIndicator.INDICATOR_STYLE_BOTTOM indicatorEnableFlow = true gradientShape = GradientDrawable.RECTANGLE gradientSolidColor = context.getCompatColor(color.user_red_important) } tabIndicator.apply { indicatorHeight = 2 * dpi indicatorWidth = 40 * dpi indicatorHeightOffset = 1 * dpi indicatorYOffset = -1 * dpi indicatorStyle = DslTabIndicator.INDICATOR_STYLE_BOTTOM indicatorEnableFlow = true gradientShape = GradientDrawable.RECTANGLE gradientSolidColor = context.getCompatColor(color.user_red_important) } invalidate()
1: 角标的默认配置请使用DslTabBadge的 defaultBadgeConfig
DslTabBadge
defaultBadgeConfig
2:Indicator的部分属性, 会根据TabLayout的横竖向智能设置, 所以此时的初始化值会无效. 等待初始化结束之后, 可以直接操作属性进行覆盖.
Indicator
TabLayout
首先库是好库,根据属性大全用xml配置也没问题。 现在我用一个类继承DslTabLayout,然后在init里面初始化一些配置。 1、角标配置失败。(onTabBadgeConfig配置也不生效,wiki里面好像是单一配置,统一配置不行,希望像xml配置一次就行了)
2、Indicator需要配置两次才能生效。(比如高宽和Offset,是因为他们的默认值不是本身?)