Search code examples
androidandroid-tablayout

How can i change TabItem Visibility programmatically?


I want to change the visibility of tab items in tablayout according to a value in code. How can I do that?


Solution

  • You can use tabLayout.removeTabAt(int position) to remove a tab at a particular position. Then use tabLayout.addTab(Tab tab, int position) to add it again.