I want to make the text of a selected tab bold. How can I do this either through xml or java code, whatever is easier.
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.account_active));
if (tab.getPosition()==0){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.booking_active));
}
if(tab.getPosition()==1){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.account_active));
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
if (tab.getPosition()==0){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.booking_deacive));
}
if(tab.getPosition()==1){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.account_deactive));
}
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
if (tab.getPosition()==0){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.booking_active));
}
if(tab.getPosition()==1){
tab.getCustomView().setBackgroundDrawable(getResources().getDrawable(R.mipmap.account_active));
}
}
});
setupTabIcons();