tabLayout.setOnTabSelectedListener
阿新 • • 發佈:2019-01-05
這個雖然簡單但還是簡單的記錄一下:
有三個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); }