Android TabWidget detect click on current tab

前端 未结 9 2131
庸人自扰
庸人自扰 2020-11-28 05:34

I am trying to find way to be able to fire an onclick event on a tab when this tab is the current tab.

I did try this way (among several other) with no success thou

9条回答
  •  孤独总比滥情好
    2020-11-28 06:24

    If you want to try android.support.design.widget.TabLayout, you can achieve it like this:

    tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
       @Override public void onTabSelected(Tab tab) {
    
       }
    
       @Override public void onTabUnselected(Tab tab) {
    
       }
    
       @Override public void onTabReselected(Tab tab) {
    
       }
    });
    

提交回复
热议问题