16
Phân mảnh không được thay thế nhưng được đặt trên phân mảnh trước đó
Hoạt động: FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment1 fragment = new Fragment1(); Fragment2 fragment2 = new Fragment2(); transaction.replace(R.id.Fragment1, fragment); transaction.addToBackStack(null); transaction.commit(); FragmentTransaction transaction2 = getSupportFragmentManager().beginTransaction(); transaction2.replace(R.id.Fragment1, fragment2); transaction2.addToBackStack(null); transaction2.commit(); Mã trong chế độ xem: <fragment android:id="@+id/Fragment1" android:name="com.landa.fragment.Fragment1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_below="@+id/include1" /> Vấn đề là, nội dung không thực sự …