Search code examples
androidiconsandroid-tablayout

Change icon in Tablayout on selected and deselected state


Sorry if this question have been asked before.

I want to change icon when it is selected in tab of tab layout. How can I do this using selector?.

I have two tabs in my application on selected state icon should change.


Solution

  • Please try this

    tabLayout.getTabAt(0).setIcon(R.drawable.selector);