Skip to content
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

SlidingTabLayout 点选 Tab 时并不会平滑滚动? #45

Open
mkjihu opened this issue Dec 29, 2020 · 2 comments
Open

SlidingTabLayout 点选 Tab 时并不会平滑滚动? #45

mkjihu opened this issue Dec 29, 2020 · 2 comments

Comments

@mkjihu
Copy link

mkjihu commented Dec 29, 2020

测试手机为HTC U11,Android 9.0

SlidingTabLayout原码中.smoothScroll预设为false

public SlidingTabLayout setCurrentTab(int currentTab) {
        return setCurrentTab(currentTab, false);
}

虽然有提供另一个重载setCurrentTab(currentTab,smoothScroll)

但SlidingTabLayout中的addTab,onRestoreInstanceState

都是直接引用setCurrentTab(mCurrentTab)......是否导致导致点击Tab时,并没有隐藏gif上的平滑效果的原因呢?

@AriesHoo
Copy link
Owner

默认点击是非平滑滚动的,从目前来看你说的需求很少很少,因为SlidingTabLayout 的本质是想手指滑动的-所以点击的时候直接切换tab而不是平滑的。

@AriesHoo
Copy link
Owner

点击的本质就是一点即达,如果这里添加平滑有种画蛇添足的嫌疑

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants