I am using a TabLayout
to switch between three tabs in my Android application. Each of the tabs contains a ListView
with people information (that I've hidden in this screenshot).
I would like to know if there is a way to have a different background for each tab? I'm not talking about the background of the fragment here, but the background behind "TAB1" "TAB2" and "TAB3".
For example, i want something like that:
I already tried to set a custom view and change its background, like this:
TabLayout.Tab memberTab = tabLayout.newTab();
memberTab.setText(R.string.tromb_tab1_title);
View v = new View(this);
v.setBackgroundColor(Color.RED);
memberTab.setCustomView(v);
But it only changes the color above the text "TAB1" and not the "tab rectangle" as a whole:
What can I do to obtain what I want?