学习Fragment遇到的一个报错_移动开发_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > 移动开发 > 学习Fragment遇到的一个报错

学习Fragment遇到的一个报错

 2014/5/28 22:50:00  lyyh.victory  博客园  我要评论(0)
  • 摘要:从现在开始,在博客园上记录自己遇到的所有android开发问题:布局文件内容:<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/container"android:orientation="horizontal"android
  • 标签:学习 一个

从现在开始,在博客园上记录自己遇到的所有android开发问题:

布局文件内容:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:orientation="horizontal"
    android:baselineAligned="false" 
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <fragment    android:name="com.Victory.myfragment.LeftFragment"  
        android:id="@+id/leftFragmentID"  
        android:layout_width="0dip"  
        android:layout_height="match_parent"  
        android:layout_weight="1" ></fragment>  
    <fragment   android:name="com.Victory.myfragment.RightFragment"
        android:id="@+id/rightFragmentID"  
        android:layout_width="0dip"  
        android:layout_height="match_parent"  
        android:layout_weight="1" ></fragment>  
    
</LinearLayout>

错误信息:

05-28 21:05:59.976: W/dalvikvm(4638): threadid=1: thread exiting with uncaught exception (group=0x4158f438)
05-28 21:05:59.986: E/AndroidRuntime(4638): FATAL EXCEPTION: main
05-28 21:05:59.986: E/AndroidRuntime(4638): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Victory.myfragment/com.Victory.myfragment.Main}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.ActivityThread.access$600(ActivityThread.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.os.Handler.dispatchMessage(Handler.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.os.Looper.loop(Looper.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.ActivityThread.main(ActivityThread.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at java.lang.reflect.Method.invokeNative(Native Method)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at java.lang.reflect.Method.invoke(Method.java:511)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at dalvik.system.NativeStart.main(Native Method)
05-28 21:05:59.986: E/AndroidRuntime(4638): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.view.LayoutInflater.rInflate(LayoutInflater.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.view.LayoutInflater.inflate(LayoutInflater.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.view.LayoutInflater.inflate(LayoutInflater.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.view.LayoutInflater.inflate(LayoutInflater.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.Activity.setContentView(Activity.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at com.Victory.myfragment.Main.onCreate(Main.java:13)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.Activity.performCreate(Activity.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)
05-28 21:05:59.986: E/AndroidRuntime(4638):     ... 12 more
05-28 21:05:59.986: E/AndroidRuntime(4638): Caused by: java.lang.IllegalStateException: Fragment com.Victory.myfragment.LeftFragment did not create a view.
05-28 21:05:59.986: E/AndroidRuntime(4638):     at android.app.Activity.onCreateView(Activity.java)

发表评论
用户名: 匿名