Created
September 16, 2019 17:08
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void agregarTab(){ | |
// el título del tab | |
String titulo = String.valueOf(viewPager.getAdapter().getCount() + 1); | |
adaptadorViewPager.agregarFragmento(new FragmentFormularioDeAvio(), titulo); | |
adaptadorViewPager.notifyDataSetChanged(); | |
agregarIconoAUltimoTab(); | |
// Enfocar la penúltima 100 milisegundos después | |
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
// Seleccionar la penúltima pestaña | |
tabLayout.setScrollPosition(viewPager.getAdapter().getCount() - 2, 0, true); | |
viewPager.setCurrentItem(viewPager.getAdapter().getCount() - 2); | |
} | |
}, 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment