📜  自定义 android tablayout - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:33.586000             🧑  作者: Mango

代码示例1
TabLayoutMediator(your_tab, your_viewPager2) { tab, position ->
     val tabView = LayoutInflater.from(this.context).inflate(R.layout.custom_view, tab_layout, false)
            when (position) {
                0 -> {
                    // you can set your tab text and color here for tab1
                }
                1 -> {
                    // you can set your tab text and color here for tab2
                }
                2 -> {
                    // you can set your tab text and color here for tab3
                }   
            }
}