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的方式添加

转载于:https://www.cnblogs.com/liaojie970/p/5852961.html

android.support.v4.app.Fragment和android.app.Fragment区别相关推荐

  1. android项目迁移到androidX:类映射(android.support.v4*)

    支持库类 AndroidX 类 android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat androidx.core ...

  2. [已解决]: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4

    今天开发的时候,发现明明有这个id,而且也通过findviewbyid获取了,但是为什么最后得到viewpager 是空呢? Caused by: java.lang.NullPointerExcep ...

  3. Andriod之import android.support.v4或者import android.support.v7提示导入错误解决办法

    问题所在原因:少了v4.jar包 解决办法:给项目添加v4.jar包就行 在使用Eclipse开发andriod程序时,程序中提示import android.support.v4.XXX或者impo ...

  4. android mainactivity 刷新fragment,Android刷新从FragmentActivity android.support.v4.app.Fragment

    我使用FragmentTabHost创建dinamically FragmentActivity.我想通过单击操作栏中的项目来刷新当前选项卡中托管的片段.Android刷新从FragmentActiv ...

  5. Required type: android.support.v4.app.Fragment Provided: android.app.Fragment

    1 android.support.v4.app.,而且必须是getSupportFragmentManager(); FragmentManager f = getFragmentManager() ...

  6. Program type already present: android.support.v4.app.BackStackRecord$Op

    Program type already present: android.support.v4.app.BackStackRecord$Op 原文:https://blog.csdn.net/zww ...

  7. android.support.v4.app.FragmentManager无法转换为android.app.FragmentManager

    昨天有同学截图问我这个问题,也就是我的MusicList中出现的报错.这里记录一下,后面的同学就可以直接参考了. 报错原因显示:需要的类型是android.app.FragmentManager,而你 ...

  8. 解决Android v4、v7包导入标红问题import android.support.v4.app.ActivityCompat;import android.support.v7.app

    解决Android v4.v7包导入标红问题 由于安卓经常性的升级,很多包都有过迁移,会造成有些包的路径变了. 如果有如下错误: import android.support.v4.app.Activ ...

  9. Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.Cor

    报错信息 Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.ap ...

  10. java.lang.ClassNotFoundException: Didn't find class android.support.v4.app.CoreComponentFactory

    android9报错: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.CoreCom ...

最新文章

  1. Python 之父:Python 4.0 可能不会来了
  2. Android--获取apk大小
  3. SecureCRTSecureFX_HH_x64_7.0.0.326 crt部署项目到服务器
  4. linux系统中使用pycharn,在pycharm中使用linux控制台
  5. 为什么会有那么多人放弃编程?
  6. Cocos2d-x 2 0 在Windows平台下的使用
  7. 拼多多关联公司申请“碰多多”、“碰碰多”商标
  8. http请求代理proxy-ajax
  9. 最后的人 - 主机程序员十年的分享
  10. 我设想的可扩展结构(插件) (二)
  11. 数据结构题集(c语言版)严蔚敏答案pdf
  12. 莫烦 pytorch
  13. ib网卡命令_InfiniBand 网卡测试
  14. JAVA基于UDP的一个聊天程序
  15. 图书馆图书搜索引擎(全球100多图书馆)
  16. 【Django】Django视图views详解
  17. 如何用火狐浏览器firefox模拟手机浏览器客户端
  18. opencv4.1无法加载python-cnn模型,编译第三方库libtensorflow_cc.so巨坑
  19. 软件企业认定的条件是什么
  20. 微服务(四)——统一网关

热门文章

  1. 面向对象高级编程(5)-使用元类
  2. Qt之QSS(白色靓丽)
  3. 4.24口语习语 听力复习
  4. Pocket Gems面经prepare: Diamond and Ruby
  5. wojilu框架代码分析之ActionProcessor.Process()
  6. 转载:Futurice-Android 开发最佳实践
  7. 潍坊首个小学“教育创客空间”落户呼家庄小学 萝卜(创客)教育走进小学课堂...
  8. 智慧型数据中心露峥嵘
  9. 《C++代码设计与重用》——2.7 转型
  10. tts语音合成小玩具