Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经实现了 ViewPageIndicator 并且运行良好。我有 3 个标签,名称分别为“Tab1”、“Tab2”和“Tab3”。我想要的是滚动选项卡时的选项卡名称。
谁能让我知道如何获取正在显示的当前选项卡的选项卡标题?
您可以从以下位置获取当前页面的标题PagerAdapter:
PagerAdapter
int currentPage = viewPager.getCurrentItem(); CharSequence pageTitle = pagerAdapter.getPageTitle(currentPage);