我想要一个有 5 个标签的 viewpager。最大限度。 3 应该一次可见,宽度相等,并且应该使所选选项卡居中。 这就像 Fotmob 的应用程序屏幕。
布局应该是这样的:
Yesterday | Live| Today | Tomorrow | Day after Tomorrow
如何使用 XLPagerTabStrip
实现这一点?
最佳答案
将 settings.style
中的 buttonBarLeftContentInset
和 buttonBarRightContentInset
设置为较高的值,这将使所选项目居中。
settings.style.buttonBarLeftContentInset = 9999
settings.style.buttonBarRightContentInset = 9999
遗憾的是,没有简单的方法可以使用 XLPagerTabStrip
设置最大可见性计数。您可以尝试为 settings.style.buttonBarMinimumInteritemSpacing
设置不同的值(考虑屏幕/字体大小)。
关于ios - 如何让 XLPagerTabStrip 将选定的选项卡居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47473646/