Closed MhuiHugh closed 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)
2个设置方法都无效 bodyBinding.dslTablayout.setCurrentItem(-1,true,false) bodyBinding.dslTablayout.dslSelector.selectorAll(false, true, false)
需要调用一次com.angcyo.tablayout.DslTabLayout#updateTabLayout
com.angcyo.tablayout.DslTabLayout#updateTabLayout
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)