android activity情景对话如何制作?两个人物对话交替进行 一个activity中 点击切换

Android系列之Fragment(一)----Fragment加载到Activity当中
上的界面展示都是通过Activity实现的,Activity实在是太常用了。但是Activity也有它的局限性,同样的界面在手机上显示可能很好看,在平板上就未必了,因为平板的屏幕非常大,手机的界面放在平板上可能会有过分被拉长、控件间距过大等情况。这个时候更好的体验效果是在Activity中嵌入&小Activity&,然后每个&小Activity&又可以拥有自己的布局。因此,我们今天的主角Fragment登场了。
一、Fragment初探:
Fragment是activity的界面中的一部分或一种行为。你可以把多个Fragment们组合到一个activity中来创建一个多面界面,并且你可以在多个activity中重用一个Fragment。你可以把Fragment认为模块化的一段activity,它具有自己的生命周期,接收它自己的事件,并可以在activity运行时被添加或删除。
Fragment不能独立存在,它必须嵌入到activity中,而且Fragment的生命周期直接受所在的activity的影响。例如:当activity暂停时,它拥有的所有的Fragment们都暂停了,当activity销毁时,它拥有的所有Fragment们都被销毁。然而,当activity运行时(在onResume()之后,onPause()之前),你可以单独地操作每个Fragment,比如添加或删除它们。当你在执行上述针对Fragment的事务时,你可以将事务添加到一个栈中,这个栈被activity管理,栈中的每一条都是一个Fragment的一次事务。有了这个栈,就可以反向执行Fragment的事务,这样就可以在Fragment级支持&返回&键(向后导航)。
当向activity中添加一个Fragment时,它须置于ViewGroup控件中,并且需定义Fragment自己的界面。你可以在layoutxml文件中声明Fragment,元素为:&fragment&;也可以在代码中创建Fragment,然后把它加入到ViewGroup控件中。然而,Fragment不一定非要放在activity的界面中,它可以隐藏在后台为actvitiy工作。
设计的哲学:
为了让界面可以在平板上更好地展示,Android在3.0版本引入了Fragment(碎片)功能,通过官方文档中的这张图片可以很明显地看到Fragment的好处:
注:左边为平板,右边为手持设备。
二、Fragment的生命周期:
因为Fragment必须嵌入在Acitivity中使用,所以Fragment的生命周期和它所在的Activity是密切相关的。
如果Activity是暂停状态,其中所有的Fragment都是暂停状态;如果Activity是stopped状态,这个Activity中所有的Fragment都不能被启动;如果Activity被销毁,那么它其中的所有Fragment都会被销毁。
但是,当Activity在活动状态,可以独立控制Fragment的状态,比如加上或者移除Fragment。
当这样进行fragment transaction(转换)的时候,可以把fragment放入Activity的back stack中,这样用户就可以进行返回操作。
使用Fragment时,需要继承Fragment或者Fragment的子类(DialogFragment, ListFragment, PreferenceFragment, WebViewFragment),所以Fragment的代码看起来和Activity的类似。
每当创建一个Fragment时,首先添加以下三个回调方法:
onCreate():系统在创建Fragment的时候调用这个方法,这里应该初始化相关的,一些即便是被暂停或者被停止时依然需要保留的东西。
onCreateView():当第一次绘制Fragment的UI时调用这个方法,该方法将返回一个View,如果Fragment不提供UI也可以返回null。注意,如果继承自ListFragment,onCreateView()默认的实现会返回一个ListView,所以不用自己实现。
onPause():当用户离开Fragment时第一个调用这个方法,需要提交一些变化,因为用户很可能不再返回来。
将Fragment加载到Activity当中有两种方式:
方式一:添加Fragment到Activity的布局文件当中
方式二:在Activity的代码中动态添加Fragment
第一种方式虽然简单但灵活性不够。添加Fragment到Activity的布局文件当中,就等同于将Fragment及其视图与activity的视图绑定在一起,且在activity的生命周期过程中,无法切换fragment视图。
第二种方式比较复杂,但也是唯一一种可以在运行时控制fragment的方式(加载、移除、替换)。
下面将分别介绍一下。
三、在Activity的布局文件中添加Fragment:(不推荐)
平板的模拟器参数如下:
然后新建一个工程文件。然后继续如下步骤:
(1)新建文件fragment_hello.xml和HelloFragment.java:
fragment_hello.xml代码如下:(即Fragment的布局文件)
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
& & android:layout_width=&match_parent&
& & android:layout_height=&match_parent&
& & android:orientation=&vertical& &
& & &EditText&
& & & & android:layout_width=&match_parent&
& & & & android:layout_height=&wrap_content&
& & & & android:hint=&请输入内容&/&
& & &RatingBar
& & & & android:id=&@+id/ratingBar1&
& & & & android:layout_width=&wrap_content&
& & & & android:layout_height=&wrap_content& /&
&/LinearLayout&
HelloFragment.java代码如下:
&1 package com.example.m01_fragment01;
&3 import android.app.F
&4 import android.os.B
&5 import android.view.LayoutI
&6 import android.view.V
&7 import android.view.ViewG
&9 public class HelloFragment extends Fragment {
11 & & @Override
12 & & public void onCreate(Bundle savedInstanceState) {
13 & & & & super.onCreate(savedInstanceState);
16 & & @Override
17 & & public View onCreateView(LayoutInflater inflater, ViewGroup container,
18 & & & & & & Bundle savedInstanceState) {
19 & & & & View view = inflater.inflate(R.layout.fragment_hello, null); &// View android.view.LayoutInflater.inflate(int resource, ViewGroup root)&
20 & & & &
23 & & @Override
24 & & public void onPause() {
25 & & & & super.onPause();
重点在于第19和20行,通过inflate()方法将自定义的fragment的布局加载进来。
19行代码中,第二个参数中,如果布局没有根,那就用null。
注:上方代码中,因为我们的程序是面对Android 4.0以上版本的,所以导入Fragment的包时,选择第一个:android.app.Fragment
(2)将Fragment添加到Activity的布局中:
修改activity_main.xml的代码如下:
&1 &LinearLayout xmlns:android=&/apk/res/android&
&2 & & xmlns:tools=&/tools&
&3 & & android:layout_width=&match_parent&
&4 & & android:layout_height=&match_parent&
&5 & & tools:context=&.MainActivity& &
&7 & & &fragment
&8 & & & & android:id=&@+id/fragment_hello&
&9 & & & & android:name=&com.example.m01_fragment02.HelloFragment&
10 & & & & android:layout_width=&wrap_content&
11 & & & & android:layout_height=&wrap_content& /&
12 &/LinearLayout&
08行和09行是关键。其中android:name属性填上你自己创建的fragment的完整类名。如下图:
当系统创建这个Activity的布局文件时,系统会实例化每一个fragment,并且调用它们的onCreateView()方法,来获得相应fragment的布局,并将返回值插入fragment标签所在的地方。
运行之后,效果如下:
实际上,这种方式在开发中并不推荐,我们来介绍另外一种方法。
四、在activity代码中添加fragment:
【实例】点击左侧fragment中的按钮,弹出右侧的fragment。新建一个工程文件,然后步骤如下:
(1)将activity_main的布局分为两部分:左边占1/4,右边占3/4。修改activity_main.xml的代码如下:
&LinearLayout xmlns:android=&/apk/res/android&
& & xmlns:tools=&/tools&
& & android:layout_width=&match_parent&
& & android:layout_height=&match_parent&
& & tools:context=&.MainActivity&
& & android:orientation=&horizontal& &
& & &LinearLayout
& & & & android:id=&@+id/left&
& & & & android:layout_width=&0dp&
& & & & android:layout_height=&match_parent&
& & & & android:orientation=&vertical&
& & & & android:layout_weight=&1&
& & & & android:background=&#00BFFF& &
& & & & &Button&
& & & & & & android:id=&@+id/button1&
& & & & & & android:layout_width=&wrap_content&
& & & & & & android:layout_height=&wrap_content& & & & & & &
& & & & & & android:text=&显示&/&
& & &/LinearLayout&
& & &LinearLayout
& & & & &android:id=&@+id/right& & & &&
& & & & android:layout_width=&0dp&
& & & & android:layout_height=&match_parent&
& & & & android:layout_weight=&3&
& & & & android:background=&#00FFFF&
& & & & android:orientation=&vertical& &
& & &/LinearLayout&
&/LinearLayout&
上方代码中,一个LinearLayout代表一个Fragment的容器,记得要给每个fragment加一个容器的id。上方代码的布局效果如下:
既然两个fragment的空间都分配好了,接下来右边的Fragment写出来。
(2)新建文件fragment_right.xml和RightFragment.java:
fragment_right.xml代码如下:(添加一个文本和按钮)
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
& & android:layout_width=&match_parent&
& & android:layout_height=&match_parent&
& & android:orientation=&vertical& &
& & &TextView
& & & & android:id=&@+id/textView1&
& & & & android:layout_width=&wrap_content&
& & & & android:layout_height=&wrap_content&
& & & & android:text=&新闻内容& /&
& & &Button
& & & & android:id=&@+id/button2&
& & & & android:layout_width=&wrap_content&
& & & & android:layout_height=&wrap_content&
& & & & android:text=&Button& /&
&/LinearLayout&
RightFragment.java代码如下:
package com.example.m01_fragment03;
import android.app.F
import android.os.B
import android.view.LayoutI
import android.view.V
import android.view.ViewG
public class RightFragment extends Fragment {
& & @Override
& & public void onCreate(Bundle savedInstanceState) {
& & & & super.onCreate(savedInstanceState);
& & @Override
& & public View onCreateView(LayoutInflater inflater, ViewGroup container,
& & & & & & Bundle savedInstanceState) {
& & & & View view = inflater.inflate(R.layout.fragment_right, null);
& & @Override
& & public void onPause() {
& & & & super.onPause();
紧接着,我们修改上方onCreateView()方法中的代码,实现点击按钮,能够弹出吐司:
&1 public View onCreateView(LayoutInflater inflater, ViewGroup container,
&2 & & & & & & Bundle savedInstanceState) {
&3 & & & & View view = inflater.inflate(R.layout.fragment_right, null);
&4 & & & & Button button = (Button)view.findViewById(R.id.button2);
&5 & & & & button.setOnClickListener(new OnClickListener() { & & & & & &
&6 & & & & & & @Override
&7 & & & & & & public void onClick(View v) {
&8 & & & & & & & & Toast.makeText(getActivity(), &我是fragment&, Toast.LENGTH_SHORT).show();
&9 & & & & & & }
10 & & & & });
11 & & & &
第04行代码:有一个单词view不要忘了。
第08行代码:第一个参数一定是getActivity,以此来获得父类的Activity
(3)在activity代码中添加fragment:
点击MainActivity中左侧的按钮,弹出右侧的Fragment,
MainActivity.java的监听器部分的代码如下:
&1 & & & & button.setOnClickListener(new OnClickListener() {
&2 & & & & & &&
&3 & & & & & & @Override
&4 & & & & & & public void onClick(View v) {
&6 & & & & & & & & //步骤一:添加一个FragmentTransaction的实例
&7 & & & & & & & & FragmentManager fragmentManager =getFragmentManager();
&8 & & & & & & & & FragmentTransaction transaction = fragmentManager.beginTransaction();
10 & & & & & & & & //步骤二:用add()方法加上Fragment的对象rightFragment&
11 & & & & & & & & RightFragment rightFragment = new RightFragment();
12 & & & & & & & & transaction.add(R.id.right, rightFragment);
14 & & & & & & & & //步骤三:调用commit()方法使得FragmentTransaction实例的改变生效
15 & & & & & & & & mit(); & & & & & & & &
16 & & & & & & }
17 & & & & });
记住上面的三个步骤。
第12行代码是整个程序的核心。add()方法里的第一个参数是容器视图资源ID,而不是layout。容器视图资源ID有两个作用:
告知FragmentManager,fragment视图应该出现在activity视图的什么地方
是FragmentManager队列中fragment的唯一标识符
您对本文章有什么意见或着疑问吗?请到您的关注和建议是我们前行的参考和动力&&
您的浏览器不支持嵌入式框架,或者当前配置为不显示嵌入式框架。15939人阅读
转载请标明出处:自从Fragment出现,曾经有段时间,感觉大家谈什么都能跟Fragment谈上关系,做什么都要问下Fragment能实现不~~~哈哈,是不是有点过~~~本篇博客力求为大家说明Fragment如何产生,什么是Fragment,Fragment生命周期,如何静态和动态的使用Fragment,Fragment回退栈,Fragment事务;以及Fragment的一些特殊用途,例如:没有布局的Fragment有何用处?Fragment如何与Activity交互?Fragment如何创建对话框?Fragment如何与ActionBar集成等等。1、Fragment的产生与介绍Android运行在各种各样的设备中,有小屏幕的手机,超大屏的平板甚至电视。针对屏幕尺寸的差距,很多情况下,都是先针对手机开发一套App,然后拷贝一份,修改布局以适应平板神马超级大屏的。难道无法做到一个App可以同时适应手机和平板么,当然了,必须有啊。Fragment的出现就是为了解决这样的问题。你可以把Fragment当成Activity的一个界面的一个组成部分,甚至Activity的界面可以完全有不同的Fragment组成,更帅气的是Fragment拥有自己的生命周期和接收、处理用户的事件,这样就不必在Activity写一堆控件的事件处理的代码了。更为重要的是,你可以动态的添加、替换和移除某个Fragment。2、Fragment的生命周期Fragment必须是依存与Activity而存在的,因此Activity的生命周期会直接影响到Fragment的生命周期。官网这张图很好的说明了两者生命周期的关系:可以看到Fragment比Activity多了几个额外的生命周期回调方法:onAttach(Activity)当Fragment与Activity发生关联时调用。onCreateView(LayoutInflater, ViewGroup,Bundle)创建该Fragment的视图onActivityCreated(Bundle)当Activity的onCreate方法返回时调用onDestoryView()与onCreateView想对应,当该Fragment的视图被移除时调用onDetach()与onAttach相对应,当Fragment与Activity关联被取消时调用注意:除了onCreateView,其他的所有方法如果你重写了,必须调用父类对于该方法的实现,3、静态的使用Fragment嘿嘿,终于到使用的时刻了~~这是使用Fragment最简单的一种方式,把Fragment当成普通的控件,直接写在Activity的布局文件中。步骤:1、继承Fragment,重写onCreateView决定Fragemnt的布局2、在Activity中声明此Fragment,就当和普通的View一样下面展示一个例子(我使用2个Fragment作为Activity的布局,一个Fragment用于标题布局,一个Fragment用于内容布局):TitleFragment的布局文件:&?xml version=&1.0& encoding=&utf-8&?&
&RelativeLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&45dp&
android:background=&@drawable/title_bar& &
&ImageButton
android:id=&@+id/id_title_left_btn&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_centerVertical=&true&
android:layout_marginLeft=&3dp&
android:background=&@drawable/showleft_selector& /&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:gravity=&center&
android:text=&我不是微信&
android:textColor=&#fff&
android:textSize=&20sp&
android:textStyle=&bold& /&
&/RelativeLayout&TitleFragmentpackage com.zhy.zhy_
import android.app.F
import android.os.B
import android.view.LayoutI
import android.view.V
import android.view.View.OnClickL
import android.view.ViewG
import android.widget.ImageB
import android.widget.T
public class TitleFragment extends Fragment
private ImageButton mLeftM
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
View view = inflater.inflate(R.layout.fragment_title, container, false);
mLeftMenu = (ImageButton) view.findViewById(R.id.id_title_left_btn);
mLeftMenu.setOnClickListener(new OnClickListener()
public void onClick(View v)
Toast.makeText(getActivity(),
&i am an ImageButton in TitleFragment ! &,
Toast.LENGTH_SHORT).show();
同理还有ContentFragment的其布局文件:&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:orientation=&vertical& &
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:gravity=&center&
android:text=&使用Fragment做主面板&
android:textSize=&20sp&
android:textStyle=&bold& /&
&/LinearLayout&package com.zhy.zhy_
import android.app.F
import android.os.B
import android.view.LayoutI
import android.view.V
import android.view.ViewG
public class ContentFragment extends Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
return inflater.inflate(R.layout.fragment_content, container, false);
MainActivitypackage com.zhy.zhy_
import android.app.A
import android.os.B
import android.view.W
public class MainActivity extends Activity
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
Activity的布局文件:&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent& &
android:id=&@+id/id_fragment_title&
android:name=&com.zhy.zhy_fragments.TitleFragment&
android:layout_width=&fill_parent&
android:layout_height=&45dp& /&
android:layout_below=&@id/id_fragment_title&
android:id=&@+id/id_fragment_content&
android:name=&com.zhy.zhy_fragments.ContentFragment&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent& /&
&/RelativeLayout&是不是把Fragment当成普通的View一样声明在Activity的布局文件中,然后所有控件的事件处理等代码都由各自的Fragment去处理,瞬间觉得Activity好干净有木有~~代码的可读性、复用性以及可维护性是不是瞬间提升了~~~下面看下效果图:4、动态的使用Fragment上面已经演示了,最简单的使用Fragment的方式~下面介绍如何动态的添加、更新、以及删除Fragment为了动态使用Fragment,我们修改一下Actvity的布局文件,中间使用一个FrameLayout,下面添加四个按钮~~~嘿嘿~~不是微信的按钮- -!&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent& &
android:id=&@+id/id_fragment_title&
android:name=&com.zhy.zhy_fragments.TitleFragment&
android:layout_width=&fill_parent&
android:layout_height=&45dp& /&
android:id=&@+id/id_ly_bottombar&
android:layout_width=&fill_parent&
android:layout_height=&55dp&
android:layout_alignParentBottom=&true&
layout=&@layout/bottombar& /&
&FrameLayout
android:id=&@+id/id_content&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:layout_above=&@id/id_ly_bottombar&
android:layout_below=&@id/id_fragment_title& /&
&/RelativeLayout&底部四个按钮的布局就不贴了,到时看效果图就明白了~~下面主Activitypackage com.zhy.zhy_
import android.app.A
import android.app.FragmentM
import android.app.FragmentT
import android.os.B
import android.view.V
import android.view.View.OnClickL
import android.view.W
import android.widget.LinearL
public class MainActivity extends Activity implements OnClickListener
private LinearLayout mTabW
private LinearLayout mTabF
private ContentFragment mW
private FriendFragment mF
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
// 初始化控件和声明事件
mTabWeixin = (LinearLayout) findViewById(R.id.tab_bottom_weixin);
mTabFriend = (LinearLayout) findViewById(R.id.tab_bottom_friend);
mTabWeixin.setOnClickListener(this);
mTabFriend.setOnClickListener(this);
// 设置默认的Fragment
setDefaultFragment();
private void setDefaultFragment()
FragmentManager fm = getFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
mWeixin = new ContentFragment();
transaction.replace(R.id.id_content, mWeixin);
public void onClick(View v)
FragmentManager fm = getFragmentManager();
// 开启Fragment事务
FragmentTransaction transaction = fm.beginTransaction();
switch (v.getId())
case R.id.tab_bottom_weixin:
if (mWeixin == null)
mWeixin = new ContentFragment();
// 使用当前Fragment的布局替代id_content的控件
transaction.replace(R.id.id_content, mWeixin);
case R.id.tab_bottom_friend:
if (mFriend == null)
mFriend = new FriendFragment();
transaction.replace(R.id.id_content, mFriend);
// transaction.addToBackStack();
// 事务提交
可以看到我们使用FragmentManager对Fragment进行了动态的加载,这里使用的是replace方法~~下一节我会详细介绍FragmentManager的常用API。注:如果使用Android3.0以下的版本,需要引入v4的包,然后Activity继承FragmentActivity,然后通过getSupportFragmentManager获得FragmentManager。不过还是建议版Menifest文件的uses-sdk的minSdkVersion和targetSdkVersion都改为11以上,这样就不必引入v4包了。代码中间还有两个Fragment的子类,ContentFragment上面已经见过,FriendFragment其实类似:package com.zhy.zhy_
import android.app.F
import android.os.B
import android.view.LayoutI
import android.view.V
import android.view.ViewG
public class FriendFragment extends Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
return inflater.inflate(R.layout.fragment_friend, container, false);
效果图:可以看到很好的实现了效果,其实这个效果以前的博客中也出现过,在博客:,有兴趣可以看看。ps:为了代码的简洁,就不添加按钮的点击变化什么的了,主要讲解功能了~~~5、Fragment家族常用的APIFragment常用的三个类:android.app.Fragment 主要用于定义Fragmentandroid.app.FragmentManager 主要用于在Activity中操作Fragmentandroid.app.FragmentTransaction 保证一些列Fragment操作的原子性,熟悉事务这个词,一定能明白~a、获取FragmentManage的方式:getFragmentManager() // v4中,getSupportFragmentManagerb、主要的操作都是FragmentTransaction的方法FragmentTransaction transaction = fm.benginTransatcion();//开启一个事务transaction.add()&往Activity中添加一个Fragmenttransaction.remove() 从Activity中移除一个Fragment,如果被移除的Fragment没有添加到回退栈(回退栈后面会详细说),这个Fragment实例将会被销毁。transaction.replace()使用另一个Fragment替换当前的,实际上就是remove()然后add()的合体~transaction.hide()隐藏当前的Fragment,仅仅是设为不可见,并不会销毁transaction.show()显示之前隐藏的Fragmentdetach()将此Fragment从Activity中分离,会销毁其布局,但不会销毁该实例attach()将从Activity中分离的Fragment,重新关联到该Activity,重新创建其视图层次<mit()//提交一个事务注意:常用Fragment的哥们,可能会经常遇到这样Activity状态不一致:State loss这样的错误。主要是因为:commit方法一定要在Activity.onSaveInstance()之前调用。上述,基本是操作Fragment的所有的方式了,在一个事务开启到提交可以进行多个的添加、移除、替换等操作。值得注意的是:如果你喜欢使用Fragment,一定要清楚这些方法,哪个会销毁视图,哪个会销毁实例,哪个仅仅只是隐藏,这样才能更好的使用它们。a、比如:我在FragmentA中的EditText填了一些数据,当切换到FragmentB时,如果希望会到A还能看到数据,则适合你的就是hide和show;也就是说,希望保留用户操作的面板,你可以使用hide和show,当然了不要使劲在那new实例,进行下非null判断。b、再比如:我不希望保留用户操作,你可以使用remove(),然后add();或者使用replace()这个和remove,add是相同的效果。c、remove和detach有一点细微的区别,在不考虑回退栈的情况下,remove会销毁整个Fragment实例,而detach则只是销毁其视图结构,实例并不会被销毁。那么二者怎么取舍使用呢?如果你的当前Activity一直存在,那么在不希望保留用户操作的时候,你可以优先使用detach。上述已经介绍完成了Fragment常用的一些方法,相信看完,大家一定清楚了Fragment的产生理由,以及如何使用Fragment,再根据API的讲解,也能明白,曾经为何觉得Fragment会出现一些列乱七八槽的问题,终究是因为没有弄清楚其生命周期。由于篇幅原因,剩下的内容留到下一篇了。在下一篇,会介绍:1、如何管理Fragment回退栈2、Fragment如何与Activity交互3、Fragment与Activity交互的最佳实践4、没有视图的Fragment的用处5、使用Fragment创建对话框6、如何与ActionBar,MenuItem集成等~~下一篇:好了,有任何问题请留言~~
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:444018次
积分:8485
积分:8485
排名:第665名
原创:128篇
评论:1583条
本人第一次录制视频~~~还望大家支持,共同进步~
文章:11篇
阅读:18408
文章:10篇
阅读:10233
文章:67篇
阅读:304745
(1)(6)(7)(11)(10)(23)(17)(18)(39)(1)(1)

我要回帖

更多关于 android中activity 的文章

 

随机推荐