I have seen many questions that say how to set color differently for selected (active) and unselected (inactive) tabs. I also know that google provides void setTabTextColors (int normalColor, int selectedColor) to achieve this.
My requirements are a little different, I'm working on a quiz with TabLayout and CardView . TabLayout allows the user to navigate between questions, and CardView used to display questions.
I need to set the color of the tabs for which the user has already selected an answer different from the one to which the user has not yet answered. By default, TextColor is black, but if the user selects an answer, then the color of the scoreboard should be blue (for example only), and it should remain so until the user exits. I have an int array called Select that will hold the value of the option that the user has selected (values ββrange from 1 to 4). By allocating the Select array, I also initialize it with -1. I thought about setting up a loop, and then if the -1 array leaves the tab as it is, or sets the color to blue.
How can I achieve this functionality?
source share