android.support.v4.app.Fragment vs android.app.Fragment 的区别
android.support.v4.app.Fragment vs android.app.Fragment 的区别
我开过平板相关应用,用了Fragment来处理。后来重新开发另外一个应用,直接引用了原来布局和代码,
我用的是android.support.v4.app.fragment居然死活通过。总是报错
“android.view.InflateException: Binary XML file line #7: Error inflating class fragment”
往下推还有提示
"Trying to instantiate a class cn.bluedrum.phone.CallPad that is not a Fragment"
at android.app.Fragment.instantiate(Fragment.java:585)
原来过的程序,现在不行,后来仔细看Android调用是android.app.Fragment的代码。后来把类改名Android.app.Fragment可以正常运行。但是不对啊,原来可以运行啊。后来解决问题,是细节上小问题,特此一记
一. android.app.Fragment的用法
android.app.Fragment 兼容的最低版本是android:minSdkVersion="11" 即3.0版
这样想支持较低版本比较难。
在Activity中找Fragment 用
可以用Activity 直接使用Fragment
二.android.support.v4.app.Fragment
android.support.v4.app.Fragment 兼容的最低版本是android:minSdkVersion="4" 即1.6版
在Activity中找Fragment 用
fragment android.support.v4.app.Fragment 需要引入包android-support-v4.jar
使用android.support.v4.app.Fragment必须要在FragmentActivity 里使用!开始的错误在Activity类中使用Fragment造成错误
android.support.v4.app.Fragment vs 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 ...
- android.support.v4.app.Fragment和android.app.Fragment区别
1.最低支持版本不同 android.app.Fragment 兼容的最低版本是android:minSdkVersion="11" 即3.0版 android.support.v ...
- 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 ...
随机推荐
- Deepgreen DB简介(转)
原文链接 Deepgreen DB 全称 Vitesse Deepgreen DB,它是一个可扩展的大规模并行(通常称为MPP)数据仓库解决方案,起源于开源数据仓库项目Greenplum DB(通 ...
- thinkphp3.1 多表联合查询代码
php代码 public function info(){ $where['openid']=session('openid');////用户session $db = M("pay&quo ...
- Unity 2d 的 SpriteMask为游戏表现带来多种可能性
孙广东 2017.7.22 http://blog.csdn.NET/u010019717 SpriteMask 是Unity 2017.1 开始添加2d功能!, Spri ...
- 什么时候应该使用Autorelease Pool
csdn首发:http://blog.csdn.net/guijiewan/article/details/46470285 Objective c使用ARC之后,一般都不需要再手动调用retain, ...
- PHP练习
<?php function table($row,$col,$c){ $str= "<table border=1>"; for ($i=0; $i <$ ...
- js之隔行换色
HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...
- 【pandas】pandas.to_datatime()---时间格式转换
标准时间格式:2012-12-21 时间转换函数:pandas.to_datatime() # -*- coding: utf- -*- # 生成数据 import pandas as pd data ...
- OC中使用单例模式
static Config * instance = nil; +(Config *) Instance { @synchronized(self) { if(nil == instance) { [ ...
- 求整数A和B的二进制表示中有多少位是不同?
如果有题目要求整数A和B二进制表示中多少位是不同的? 那我们要先考虑一个unsigned类型中变量1的个数?我们可以考虑简单的移位运算,向右移位,我们进行判断如果不是1直接丢掉,使用&运算符即 ...
- Java [Leetcode 387]First Unique Character in a String
题目描述: Given a string, find the first non-repeating character in it and return it's index. If it does ...