angcyo / DslTabLayout

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

动态配置数据,默认全不选中无效。还是选中上次选择的下标 #98

Closed MhuiHugh closed 5 months ago

MhuiHugh commented 5 months ago

bodyBinding.dslTablayout.apply { removeAllViews() viewModel.labelList?.forEach { val textView = TextView(context) textView.text = it.labelName textView.gravity = Gravity.CENTER addView(textView) textView.invalidate() } //tabDefaultIndex = -1 //setCurrentItem(-1, false, false) ///dslSelector.selectorAll(false, true, false) } bodyBinding.dslTablayout.dslSelector.selectorAll(false, true, false)

MhuiHugh commented 5 months ago

2个设置方法都无效 bodyBinding.dslTablayout.setCurrentItem(-1,true,false)
bodyBinding.dslTablayout.dslSelector.selectorAll(false, true, false)

angcyo commented 5 months ago

需要调用一次com.angcyo.tablayout.DslTabLayout#updateTabLayout