-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presence of badges messes up unselection of tabs #266
Comments
The problem is that when badges are added, the newly created Then when the user selects tab 0 again, One solution would be to reset the tag of all
To be honest, I think a cleaner solution would be to always use the As a temporary ugly workaround in my application code I managed to solve the problem like this:
|
When using badges, an extra FrameLayout is inserted as the container for each tab. This container inherits the tag of the pre-badge tab view, but the tag is not reset on the pre-badge tab view. This causes selection and unselection of tabs to fail because findViewWithTag will erroneously find the now obsolete tab views when searching for active tabs, resulting in multiple tabs being visually selected when changing tabs. By clearing the tag of the old (now inner) view when putting it in the new tab container, we can ensure that findViewWithTag will only find relevant views. This fixes roughike#266.
I have three tabs. Before using badges, selection and unselection works just fine.
After adding badges (but even without showing them), unselection does not work.
For example, if initially tab 0 is selected and I click on tab 2, tab 2 becomes visually selected and tab 0 is visually unselected. But if I then click tab 0 again, both tabs 0 and 2 stay visually selected. In this case I have debugged it enough to see that what happens is an unselect(0) followed by a select(0) instead of unselect(2) followed by select(0).
Since the presence of badges apparently mean you are adding one more container layout, I suppose the tags used for tracking active and inactive tabs doesn't work.
I am using 1.3.3.
The text was updated successfully, but these errors were encountered: