当前位置: 代码迷 >> 综合 >> tabLayout.setOnTabSelectedListener
  详细解决方案

tabLayout.setOnTabSelectedListener

热度:99   发布时间:2023-10-19 07:04:22.0

这个虽然简单但还是简单的记录一下:

tabLayout.setOnTabSelectedListener

有三个tablayout,这是每个log日志打印的结果

自己试验过的都能明白这三个状态是什么意思,贴上源码的解释:

 /*** Callback interface invoked when a tab's selection state changes.*/public interface OnTabSelectedListener {/*** Called when a tab enters the selected state.当选项卡进入选定状态时调用。** @param tab The tab that was selected选中的选项卡*/public void onTabSelected(Tab tab);/*** Called when a tab exits the selected state.当选项卡退出所选状态时调用** @param tab The tab that was unselected选项卡未选中的选项卡*/public void onTabUnselected(Tab tab);/*** Called when a tab that is already selected is chosen again by the user. Some applications当用户再次选择已选中的选项卡时调用。一些应用程序可以使用此操作返回到类别的顶层。* may use this action to return to the top level of a category.** @param tab The tab that was reselected.重新选择的选项卡。*/public void onTabReselected(Tab tab);}