ActionBarSherlock, ViewPager, TabsAdapter nested Tab Fragments

前端 未结 1 1719
孤城傲影
孤城傲影 2021-01-04 22:59

I implemented a ActionBarSherlock with a ViewPager and a TabsAdapter. It works well but now I tried to \"push\" from a Framework Loaded in \"Tab 1\" another Fragment.

<
1条回答
  •  礼貌的吻别
    2021-01-04 23:56

    I gotcha!

    Let me explain, you need to put an id on your Layout that you want to replace, my example:

    
    
        
    
    
    

    So I just put mine: android:id="@+id/Framelay" Then I can use this Id to replace for the new fragment, what I mean is that all the content inside this Layout will be replaced by the new Fragment, as I called DetailFragment.

    FragmentManager fragmentManager = getFragmentManager();  
    FragmentTransaction fragmentTransaction = fragmentManager  
            .beginTransaction();  
    DetailFragment fragment3 = new DetailFragment();  
    fragmentTransaction.replace(R.id.Framelay, fragment3);  
    fragmentTransaction.commit(); 
    

    0 讨论(0)
提交回复
热议问题