xml 쪽에는
android:id="@+id/fragment_place"
android:layout_height="match_parent">
or
android:id="@+id/fragment_place"
android:layout_marginTop="120dp"
android:layout_height="match_parent"
android:layout_width="match_parent" >
.java 파일에는
...
// Create new fragment and transaction
Fragment newFragment = new FragmentDefault();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
transaction.replace(R.id.fragment_place, newFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
https://github.com/codepath/android_guides/wiki/Creating-and-Using-Fragments
댓글 없음:
댓글 쓰기