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

前端 未结 3 1463
灰色年华
灰色年华 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:26

    I was using Tablayout, which is privided by AndroidStudio library. while adding tabs Just use setCustomView() to each and every tab which you would like to customize. something like below

        tabLayout.addTab(tabLayout.newTab().setText("FirstTab"));  // default tab
        tabLayout.addTab(tabLayout.newTab().setText("SecondTab").setCustomView(R.layout.tabview));  // Customized tab
    

    And below is the layout design for particular Tab to fill our requirement, Here I am just makeing the Tab text color Different

    
      
    
        android:textStyle="bold"/>
    
    
    

提交回复
热议问题