Trying to add a fragment to my fragment container FrameLayout

前端 未结 3 2061
难免孤独
难免孤独 2020-12-18 17:45

I have created an xml file called editor.xml which contains a FrameLayout. In my main activity I am trying to add my custom fragment to my FrameLayout.

The error I r

3条回答
  •  没有蜡笔的小新
    2020-12-18 18:48

    add commit() like this

     getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, firstFrag).commit();
    

提交回复
热议问题