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

在使用该库中遇到的一个问题,tablayout初始化状态异常 #57

Open
loper7 opened this issue Jul 14, 2020 · 4 comments
Open

Comments

@loper7
Copy link

loper7 commented Jul 14, 2020

在同一个项目中,同样的使用方式,再某一些activity或fragment内设置的初始字体大小或字宽并非为预期的值,通过设置viewPager.currentItem = 0也无效,只有当手动滑动viewPager改变page后才会恢复到预期的样式

@whoAllen
Copy link

我也遇到这个问题了,请问有解决方案么?

@whoAllen
Copy link

我也遇到这个问题了,请问有解决方案么?

找到解决方法了,是我使用的方式不对。你可以看一下作者的Demo,https://github.com/AndroidKun/XTabLayout/blob/master/app/src/main/java/com/androidkun/xtablayout/MainActivity.java

@loper7
Copy link
Author

loper7 commented Jul 23, 2020

viewPager.adapter = adapter
        viewPager.offscreenPageLimit = adapter.count
        tabLayout.setupWithViewPager(viewPager)

        viewPager.currentItem = 0

这是我的代码,感觉并不是使用的问题

@whoAllen
Copy link

我觉得问题是在Adapter中,你看看作者Demo中的Adapter:
https://github.com/AndroidKun/XTabLayout/blob/master/app/src/main/java/com/androidkun/xtablayout/FragmentAdapter.java

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