如何让 XLPagerTabStrip 将选定的选项卡居中?
How can I have center the selected tab with XLPagerTabStrip?
我想要一个有 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
.
设置不同的值(考虑 screen/font 大小)
我想要一个有 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
.