angcyo / DslTabLayout

:hearts: Android界最万能的TabLayout(不仅仅是TabLayout), 支持任意类型的item, 支持Drawable类型的指示器,智能开启滚动,支持横竖向布局等
https://github.com/angcyo/DslAdapter
MIT License
1.55k stars 145 forks source link

我这边选中和未选中的颜色属性失效 #23

Closed AndMy closed 4 years ago

AndMy commented 4 years ago

app:tab_select_color="#F42834" app:tab_deselectcolor="@color/c6" 用下面的代码设置也是没效果的 onSelectIndexChange = { fromIndex, selectIndexList, reselect, -> val toIndex = selectIndexList.first() tabSelectColor = Color.parseColor("#F42834") tabDeselectColor = Color.parseColor("#666666") _viewPagerDelegate?.onSetCurrentItem(fromIndex, selectIndexList.last()) } 能帮我看一下什么问题?

AndMy commented 4 years ago

可以了,我在textview外面嵌套了一层ConstraintLayout布局,item布局必须是textview?

angcyo commented 4 years ago

可以了,我在textview外面嵌套了一层ConstraintLayout布局,item布局必须是textview?

不是必须的.

可以通过configTabLayoutConfig指定TextView控件的id. 属性名:tabTextViewId

scsfwgy commented 2 years ago

代码动态添加单项:A、B、C。其中A、C是TextView。B是:LinearLayout->TextView+ImageView。请问改怎么改动呢?没看懂。 @angcyo

可以了,我在textview外面嵌套了一层ConstraintLayout布局,item布局必须是textview?

不是必须的.

可以通过configTabLayoutConfig指定TextView控件的id. 属性名:tabTextViewId

angcyo commented 2 years ago

可以实现onGetTextStyleView回调:

如下:

configTabLayoutConfig {
    onGetTextStyleView = { itemView, _ ->
        itemView.find(R.id.lib_tab_text_view)
    }
    onGetIcoStyleView = { itemView, _ ->
        itemView.find(R.id.lib_tab_image_view)
    }
}
scsfwgy commented 2 years ago

感谢及时回复。但是A、B、C我是代码动态添加的,没有id啊。

scsfwgy commented 2 years ago

懂了。感谢。