귀하의 질문을 올바르게 이해하면 이것이 어떻게 될 것입니다.
목록 조각 (조각 A) 및보기 조각 (조각 B)에 대한 조각 클래스를 작성했다고 가정합니다.
조각보기를 사용하여 조각보기를 레이아웃보기에서 바꿀 수 있습니다.
//grab fragmentManager, this will allow us to switch out fragments
FragmentManager fragManager = getFragmentManager();
FragmentTransaction fragTransaction = fragManager.beginTransaction();
//first remove the current fragment
fragTransaction.remove(fragManager.findFragmentById(R.id.layout_view));
//replace the current FragmentA with FragmentB
fragTransaction.replace(R.id.layout_view, new FragmentB());
//add to backstack if you want the android back button to work properly
fragTransaction.addToBackStack(null);
//and lastly, we commit the changes to the fragmentManger's transaction
fragTransaction.commit();
이 정보가 도움이되기를 바랍니다.
이것은 매우 광범위하고 일반적인 질문입니다. 당신은 더 구체적 일 수 있습니까? – StuStirling
더 자세한 내용을 포함하도록 질문을 편집했습니다. 감사. – Namratha