Answer the question
In order to leave comments, you need to log in
How to correctly call tabs in an Android application?
www.fandroid.info/kak-sozdat-vkladki-tablayout.. watched this lesson! Everything worked out, but I have a question: How to make it so that another xml would open by flipping, not peoplefragment.xml, but for example peoplefragment2.xml, I'm just learning Java and would like to figure it out!
Answer the question
In order to leave comments, you need to log in
Create any other fragment like PeopleFragment2 and in setupViewPager change PeopleFragment to your fragment.
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(new PeopleFragment(), "People");
adapter.addFragment(new PeopleFragment2(), "Group"); //PeopleFragment2
adapter.addFragment(new OtherFragment3(), "Calls"); //Любой другой фрагмент
viewPager.setAdapter(adapter);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question