码迷,mamicode.com
首页 > 移动开发 > 详细

Android Fragment

时间:2014-11-08 11:58:29      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   io   color   ar   sp   div   

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

标签:android   style   blog   http   io   color   ar   sp   div   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!