Skip to content

Commit cd259f1

Browse files
Fix Tab listener
1 parent 42c301d commit cd259f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/src/main/java/com/example/d_rom/supportdesigndemo/MainActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ protected void onCreate(Bundle savedInstanceState) {
6161
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
6262
tabLayout.setupWithViewPager(viewPager);
6363
tabLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent));
64-
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
64+
tabLayout.setOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
6565
@Override
6666
public void onTabSelected(TabLayout.Tab _tab) {
67+
super.onTabSelected(_tab);
6768
if (_tab.getPosition() % 2 == 0){
6869
mFab.show();
6970
}else {

0 commit comments

Comments
 (0)