layout.setCustomTabView(new SmartTabLayout.TabProvider() {
@Override
public View createTabView(ViewGroup container, int position, PagerAdapter adapter) {
ImageView icon = (ImageView) inflater.inflate(R.layout.custom_tab_icon1, container,
false);
switch (position) {
case 0:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp));
break;
case 1:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp));
break;
case 2:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp));
break;
case 3:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_flash_on_white_24dp));
break;
default:
throw new IllegalStateException("Invalid position: " + position);
}
return icon;
}
});
In this code snippet icons are set on the basis of position. Is there any way I can set it on the basis of tab title?(instead of position, tab title could be used) Actually in my I give the users the ability to reorder/disable tabs.
First of all thank you for such a great library!
The normal icon tabs are implemented this way-
layout.setCustomTabView(new SmartTabLayout.TabProvider() { @Override public View createTabView(ViewGroup container, int position, PagerAdapter adapter) { ImageView icon = (ImageView) inflater.inflate(R.layout.custom_tab_icon1, container, false); switch (position) { case 0: icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp)); break; case 1: icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp)); break; case 2: icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp)); break; case 3: icon.setImageDrawable(res.getDrawable(R.drawable.ic_flash_on_white_24dp)); break; default: throw new IllegalStateException("Invalid position: " + position); } return icon; } });
In this code snippet icons are set on the basis of position. Is there any way I can set it on the basis of tab title?(instead of position, tab title could be used) Actually in my I give the users the ability to reorder/disable tabs.
Is there any way I can achieve this?