TabLayout 设置tab不选中
1.默认不选中
val tab =binding.tbClassfiyChild.newTab()
tbClassfiyChild.addTab(tab,false)
2.再次点击 取消选中
binding.tbClassfiyChild.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener{
override fun onTabReselected(tab: TabLayout.Tab?) {tab?.view?.isSelected=!(tab?.view?.isSelected?:false)
}
}
网友评论