[TabLayout] setScrollPosition is not working correctly
See original GitHub issueCalling setScrollPosition()
with updateSelectedText = true
and updateIndicatorPosition = true
doesn’t set the indicator to the specified position:
Actual result | Expected result |
---|---|
Material Library version: 1.8.0-alpha03
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to scroll tablayout programmatically - Android
So first three tabs are visible on screen and rest of them are invisible which can be scroll using swipe gesture. The problem...
Read more >TabLayout | Android Developers
Sets the tab indicator's color for the currently selected tab. If the tab indicator color is not Color.TRANSPARENT , the indicator will be ......
Read more >com.google.android.material.tabs.TabLayout.setScrollPosition ...
Best Java code snippets using com.google.android.material.tabs.TabLayout.setScrollPosition (Showing top 3 results out of 315).
Read more >Tab click not working after swipe [37057275] - Issue Tracker
Have a viewpager + tablayout. When you swipe the viewpager, then click on the previous tab, the viewpager doesn't scroll to the new...
Read more >bug: setCurrentItem() does not scroll tab to proper position #10
the content is fine, it shows the tabToSelect fragment. however the tablayout is not scrolling and still showing original position.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah I see that the onLayout call isn’t expected and is caused by updating the tab visuals to the view selection
I do agree that although this method really shouldn’t be being used, the previous behavior should be re-instated, will re-open this issue and look into this more closely after the holidays
If your logic is correct, why do you need
updateIndicatorPosition
at all if it is ignored, and the position of the indicator is updated inonLayout()
anyway?I agree, the method has a very unfortunate name, it has a dual purpose, has some problems with documentation, etc. But this method used to work properly, and I think consumers expect it to continue to work or some alternative will be given.