Android replace the current fragment with another fragment

前端 未结 6 1335
迷失自我
迷失自我 2020-11-28 09:23

I just started with fragment design for HoneyComb. I created two fragments. When i click a button in the left side fragment, a new fragment is created in right side. Meanwh

6条回答
  •  伪装坚强ぢ
    2020-11-28 09:45

    it's very simple how to replace with Fragment.

    DataFromDb changeActivity = new DataFromDb();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.changeFrg, changeActivity);
        transaction.commit();
    

提交回复
热议问题