Change Tab Icon color

Asked

Viewed 74 times

0

Hello

I’m using the class Slidingtablayout normally.

But I would like you to change the color when selecting the item or Fragment

The slidingTabLayout settings I’m making are those on onCreate:

Mainactivity.class

slidingTabLayout.setCustomTabView( R.layout.tab_view, R.id.text_item_tab );
slidingTabLayout.setDistributeEvenly( true );
slidingTabLayout.setSelectedIndicatorColors(ContextCompat.getColor( this, R.color.colorTabIndicator ));
slidingTabLayout.setViewPager( viewPager );

Slidingtablayout.class

Within the method populateTabStrip added a few lines and nothing:

private void populateTabStrip() {
   /* resto do código */

  int color = ContextCompat.getColor( tabView.getContext(), R.color.colorTabIndicator );
  tabTitleView.setTextColor( color );

}

inserir a descrição da imagem aqui

  • You will have to create a list of the 2 types of icons, list_normalicons, and list_selectedicons, when the transition occurs, your imageview will have to change the icon

  • I decided using an easier one. The Tablayout.

  • It’s a good option =)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.