android.support.v4.app.Fragment和android.app.Fragment区别
1.最低支持版本不同
android.app.Fragment 兼容的最低版本是android:minSdkVersion="11" 即3.0版
android.support.v4.app.Fragment 兼容的最低版本是android:minSdkVersion="4" 即1.6版
2.需要导jar包
fragment android.support.v4.app.Fragment 需要引入包android-support-v4.jar
3.在Activity中取的方法不同
android.app.Fragment使用 (ListFragment)getFragmentManager().findFragmentById(R.id.userList) 获得 ,继承Activity
android.support.v4.app.Fragment使用 (ListFragment)getSupportFragmentManager().findFragmentById(R.id.userList) 获得 ,需要继承android.support.v4.app.FragmentActivity
4.<fragment>标签的使用情况
android.app.Fragment可以使用<fragment>标签的,这点很重要,
android.support.v4.app.Fragment不能用<fragment>标签的,否则会抛出android.view.InflateException: Binary XML file line #7: Error inflating class fragment异常
需要在程序中通过add或者replace的方式添加
android.support.v4.app.Fragment和android.app.Fragment区别的更多相关文章
- android.support.v4与Android.support.v7
Android提供了android.support.v4和android.support.v7两个库,以便低版本API可以使用高版本API的功能. Fragment(碎片)类,是在Android 3. ...
- android studio: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>: java.lang.NoClassDefFoundError: Failed resolution o
今天在运行部署项目时logcat弹出下列错误: -- ::-/? E/Zygote: v2 -- ::-/? I/libpersona: KNOX_SDCARD checking this -- :: ...
- android.support.v4.widget.DrawerLayout使用
activity_main.xml布局如下: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas ...
- import android.support.v4或者import android.support.v7提示导入错误解决办法
转自: http://blog.csdn.net/forandever/article/details/37655139 在使用Eclipse开发andriod程序时,程序中提示import and ...
- 在布局中使用android.support.v4.app.Fragment的注意事项
1.Activity必须继承android.support.v4.app.FragmentActivity 2.fragment标签的name属性必须是完全限定包名,如下: <LinearLay ...
- Attempt to write to field 'android.support.v4.app.FragmentManagerImpl android.support.v4.app.Fragment.mFragmentManager' on a null object reference
E/AndroidRuntime﹕ FATAL EXCEPTION: mainProcess: org.example.magnusluca.drawertestapp, PID: 3624java. ...
- Android fragment切换后onresume时报 Attempt to write to field 'int android.support.v4.app.Fragment.mNextAnim'
动态加载fragment以后,调用了remove方法移除Fragment,在返回来的时候报 Attempt to write to field 'int android.support.v4.app. ...
- [转]android.support.v4.app.Fragment和android.app.Fragment区别
1.最低支持版本不同 android.app.Fragment 兼容的最低版本是android:minSdkVersion="11" 即3.0版 android.support ...
- android.support.v4.app.Fragment vs android.app.Fragment 的区别
android.support.v4.app.Fragment vs android.app.Fragment 的区别 我开过平板相关应用,用了Fragment来处理.后来重新开发另外一个应用,直接引 ...
随机推荐
- HashCheck
https://github.com/gurnec/HashCheck
- 1.mybatis简介
mybatis简介 MyBatis 是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改名为My ...
- python内置函数的归集
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明. Python内置(built-in)函数随着python解释器的运行而创建.在Pytho ...
- NS_ASSUME_NONNULL_BEGIN,NS_ASSUME_NONNULL_END
Nonnull区域设置(Audited Regions) 如果需要每个属性或每个方法都去指定nonnull和nullable,是一件非常繁琐的事.苹果为了减轻我们的工作量,专门提供了两个宏:NS_AS ...
- Entity Framework 学习初级篇--基本操作:增加、更新、删除、事务(转)
摘自:http://www.cnblogs.com/xray2005/archive/2009/05/17/1458568.html 本节,直接写通过代码来学习.这些基本操作都比较简单,与这些基本操作 ...
- 百度翻译word-wrap,页面错乱原因查找过程(已修复)
今天群里有人发问, 进入百度翻译http://fanyi.baidu.com/#auto/zh/, 输入word-wrap,发现页面错乱. 寻找错乱原因. 上图 开始查找原因: 1.从请求入手 从ch ...
- git学习笔记05-从远程库克隆
现在,假设我们从零开发,那么最好的方式是先创建远程库,然后,从远程库克隆. 首先,登陆GitHub,创建一个新的仓库,名字叫gitskills: 我们勾选Initialize this reposit ...
- C++大数类模板
友情提示:使用该模板的注意了,在大数减法里有一个小错误,导致减法可能会出错 // 原来的写法,将t1.len错写成了len ] == && t1.len > ) { t1.len ...
- ubuntu12.04开启远程桌面
我们共享所使用的协议是rdp,所以我们要装这个东西. sudo apt-get install xrdp sudo apt-get install vnc4server tightvncserver ...
- SAP 批量查看凭证更改记录
1,在凭证上点击环境->凭证变更 查找.2,通过运行程序 SE38:RSSCD1TS 根据对象类.对象标识查找. 3,SE16N/SE16/SE11查看标准表,CDHDR(更改凭证抬头),CDP ...