0

Please help. Have already tried all existing solutions but it does not work. There is the part of the code

        tabLayout.getTabAt(2)?.customView?.setBackgroundColor(Color.parseColor("#000000"))
Bo Z
  • 2,359
  • 1
  • 13
  • 31
  • In the past we've always needed to use a drawable background, and use a `selector` in order to change the background color. See this answer: https://stackoverflow.com/a/32613364/4409409 – Daniel Nugent Feb 03 '19 at 17:58

1 Answers1

1

Instead of customView() use getCsutomView(). Code should be like:

tabLayout.getTabAt(2)?.getCustomView?.setBackgroundColor(Color.parseColor("#000000"))

This should fix your problem.

Abhishek
  • 648
  • 7
  • 8