How to customize individual tabs? (changing background color, indicator color and text color)

前端 未结 3 1462
灰色年华
灰色年华 2020-12-03 12:13

In this link : How do I apply a style programmatically?

Kevin Grant gave a explaination to this question my problem with his code is the context part. To be precise

3条回答
  •  时光说笑
    2020-12-03 12:37

    if another one using TabLayout as in my case i used this snippet

    tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                tab.setCustomView(R.layout.chat_tab);
    
            }
    
            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                tab.setCustomView(null);
            }
    
            @Override
            public void onTabReselected(TabLayout.Tab tab) {
    
            }
        });
    

提交回复
热议问题