Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 16, 2019 17:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save parzibyte/b558b0aaacb74f1fadd327a47cf772fd to your computer and use it in GitHub Desktop.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
viewPager = view.findViewById(R.id.viewPagerAvios);
tabLayout = view.findViewById(R.id.tabLayoutAvios);
adaptadorViewPager = new AdaptadorViewPager(getActivity().getSupportFragmentManager());
tabLayout.setupWithViewPager(viewPager);
agregarTabsIniciales(viewPager);
agregarIconoAUltimoTab();
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (tab.getPosition() == viewPager.getAdapter().getCount() - 1) {
agregarTab();
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment