Find solution

How to replace a fragment of view pager with other new fragment in android?

Check our answers to ‘How to replace a fragment of view pager with other new fragment in android?’ - we found 36 replies and comments relevant to this matter. The best answers are submitted by users of Stack Overflow, Quora and Yahoo! Answers.

Best solution

  • How to replace View Pager view completely with a new Fragment in Android

    I have the following xml file: <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" /> I have three fragments in the view pager. In one of the fragment I'm trying to launch a new fragment using this code : FragmentTransaction trans = getFragmentManager() .beginTransaction(); trans.replace(R.id.pager, new SubscriptionFragment...

    Answer:

    Do not Add, ViewPager Inside FrameLayout. <FrameLayout xmlns:android="http://schemas.android...

    Mark as irrelevant Undo

Other solutions