0

I'm using PagerTabStrip with a ViewPager to go between the different views of my app and it works well. I use drawables as the PageTitles with this method:

https://stackoverflow.com/a/12837635/7459644

This also works really well, I do however want to change the colors of the drawables when they are selected, is there a way to do this? I use a onPageListener, so I do have a callback when a certain page is selected, I simply don't know how to change the color of the given Page-title drawable when that page is selected. For text there is a build-in method, but I can't find any information regarding drawables in the official documentation.

Arya
  • 1,729
  • 3
  • 17
  • 35
Felix Eder
  • 325
  • 3
  • 16

1 Answers1

0

As @rupinderjeet stated in the comments, I solved it by keeping the drawable in an array before adding them to the PagerTabStrip. Since I had a reference to the drawables, I simply added a method that changes the colors of the drawables and call it from my onPageListener from my ViewPager. Works like a charm!

drawable.setColorFilter(0xffff0000, PorterDuff.Mode.SRC_ATOP);
rupinderjeet
  • 2,984
  • 30
  • 54
Felix Eder
  • 325
  • 3
  • 16