首页 > 移动平台 > 详细

Android Fragment

时间:2014-11-08 11:55:18      阅读:297      评论:0      收藏:0      [点我收藏+]

1. add a fragment to a view

FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.add(R.id.fragment_container, mFriendsFragment);
ft.addToBackStack(null);// this is optional, use this if you want to come back to the old fragment
ft.commit();

main activity view

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

 

Android Fragment

原文:http://www.cnblogs.com/phoenix13suns/p/4082885.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!