How to create an Android Tabbed Dialog containing fragments?

后端 未结 4 1870
一生所求
一生所求 2021-02-07 22:46

Can anyone point me to an example or show me how to create a simple Tabbed Dialog in Android where the contents of each tab are Fragments? All the exa

4条回答
  •  情书的邮戳
    2021-02-07 23:10

    Try using DialogFragment instead and on your dialogfragment layout include a LinearLayout for fragmentTransaction.

    FragmentTransaction t = getSupportFragmentManager().beginTransaction();  
    String Tag = fragment.getClass().getSimpleName(); 
    t.replace(R.id.llTabFragmentContainer, fragment, Tag); 
    t.commit(); 
    

    fragment is your tab fragment. cheeers

提交回复
热议问题