Fixed number of tabs per page in TabLayout

房东的猫 提交于 2021-02-11 14:31:00

问题


I am using scrollable TabLayout with a ViewPager.
I want to make sure that at any given time I have 7 tabs displayed per page. Even if the total number of tabs is 10, I want to have 7 per page, and scroll to expose the other 3.
I can't find a property to control the number of tabs displayed.


回答1:


Eventually what worked for me was to calculate the desired size of each cell to get the total amount of tabs that I needed per page and set app:tabMaxWidth inside android.support.design.widget.TabLayout



来源:https://stackoverflow.com/questions/57179855/fixed-number-of-tabs-per-page-in-tablayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!