android.view.InflateException: Binary XML file line #x: Error inflating class Fragment
来源:互联网 发布:美国计算机硕士 知乎 编辑:程序博客网 时间:2024/05/21 11:08
解决方法一:如果你需要的的android:minSdkVersion大于等于11
1.1首先根据你的自定义Fragment来
import android.app.Fragment;
import android.os.Bundle;import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class DitalFragment extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// TODO Auto-generated method stub
return inflater.inflate(R.layout.test_fragment_ditel, container,false);
}
}
如果你是import android.app.Fragment包,f那么你的android:minSdkVersion必须大于等于11。android:minSdkVersion="11"
1.2注意的第二点,fragment的id必不可少,android:name的自定义的fragment的路径必须正确
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/frag_tital"
android:name="com.tk.abctest.ui.TitalFragment"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="8"
/>
<fragment
android:id="@+id/frag_dital"
android:name="com.tk.abctest.ui.DitalFragment"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
1.3注意的第三点,对于import android.app.Fragment包的activity则没有要求可以为FragmentActivity,或者Activity
1.4 当然还有mainifest的android:minSdkVersion="4"
解决方法二:如果你需要的的android:minSdkVersion大于等于4
2.1对于自定义fragment 需要import android.support.v4.app.Fragment;
2.2 同上fragment的id必不可少,android:name的自定义的fragment的路径必须正确
2.3 对于import android.support.v4.app.Fragment包的activity则必须为FragmentActivity,不能是Activity
2.4 当然还有mainifest的android:minSdkVersion="11"
- android.view.InflateException: Binary XML file line #x: Error inflating class Fragment
- Fragment异常:android.view.InflateException: Binary XML file line #35: Error inflating class fragment
- android.view.InflateException: Binary XML file: Error inflating class fragment
- Android - android.view.InflateException: Binary XML file line #: Error inflating class fragment
- android.view.InflateException: Binary XML file line #7: Error inflating class fragment
- android.view.InflateException: Binary XML file line #10: Error inflating class fragment
- InflateException: Binary XML file line #20: Error inflating class fragment
- InflateException:Binary XML file line #31: Error inflating class fragment
- android自定义View “android.view.InflateException: Binary XML file line # : Error inflating class"
- android.view.InflateException: Binary XML file line #36: Error inflating
- 自定义view 出现android.view.InflateException: Binary XML file line #15: Error inflating class
- 堆栈溢出导致的Caused by: android.view.InflateException: Binary XML file line #X: Error inflating class
- android 开发 google map 的android.view.InflateException:Binary XML file line # 10:Error inflating class
- Android编程:解决异常“android.view.InflateException: Binary XML file line # : Error inflating class”
- android编程:解决异常“android.view.InflateException: Binary XML file line # : Error inflating class”
- Android编程:解决异常“android.view.InflateException: Binary XML file line # : Error inflating class”
- android.view.InflateException: Binary XML file line #10: Error inflating class com.android.xiong.han
- android编程:解决异常“android.view.InflateException: Binary XML file line # : Error inflating class”
- windows mysql提示:1045 access denied for user'root'@'localhost' using password yes
- iPhone电量显示突然消失的原因(修正说法不严谨)
- 数字IC工程师的技能树(转载)
- mysql数据库表设计三大范式
- BASH 实例 第三部分
- android.view.InflateException: Binary XML file line #x: Error inflating class Fragment
- Web服务
- Http、socket和TCP/IP
- android 九宫格手势密码 纯代码实现
- myeclipse10 破解 激活
- Visio做出的VSD图转化为EPS方式
- Oracle 常见错误及解决方法
- Robolectric例子跑通
- Sybase ASE XA分布式事务支持