Arvin_ghost 2015-09-13 02:23 采纳率: 0%
浏览 1434
已采纳

android layout抛出runtimeexception

实在搞不明白,求指教啊

布局代码贴出来

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/parentLayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    tools:context="com.seedxyx.noteinfingers.activity.OnePageAty">
<LinearLayout
    android:id="@+id/visualLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
    <TextView
        android:background="@drawable/head1"
        android:layout_weight="1"
        android:gravity="start"
        android:id="@+id/bookName"
        android:layout_width="fill_parent"
        android:layout_height="0dp" />
        <!--下面一行报错-->
    <ScrollView
        android:background="@drawable/content1"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="10">
    <LinearLayout
        android:id="@+id/layout"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    </LinearLayout>
    </ScrollView>
    <TextView
        android:background="@drawable/end1"
        android:layout_weight="1"
        android:gravity="end"
        android:id="@+id/pageNumber"
        android:layout_width="fill_parent"
        android:layout_height="0dp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/hiddenLayout"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="100dp">
    <Button
        android:id="@+id/btnCamera"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="fill_parent" />
    <Button
        android:layout_weight="1"
        android:id="@+id/btnVideo"
        android:layout_width="0dp"
        android:layout_height="fill_parent" />
    <Button
        android:layout_weight="1"
        android:id="@+id/btnSound"
        android:layout_width="0dp"
        android:layout_height="fill_parent" />
    <Button
        android:layout_weight="1"
        android:id="@+id/btnDelete"
        android:layout_width="0dp"
        android:layout_height="fill_parent" />
</LinearLayout>

    </LinearLayout>

打印的异常栈:

 09-13 10:12:38.216  18008-18008/com.seedxyx.noteinfingers E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.seedxyx.noteinfingers/com.seedxyx.noteinfingers.activity.OnePageAty}: android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.ScrollView
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2067)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
            at android.app.ActivityThread.access$600(ActivityThread.java:133)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4794)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.ScrollView
            at android.view.LayoutInflater.createView(LayoutInflater.java:613)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
            at android.app.Activity.setContentView(Activity.java:1867)
            at com.seedxyx.noteinfingers.activity.OnePageAty.onCreate(OnePageAty.java:92)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
            at android.app.ActivityThread.access$600(ActivityThread.java:133)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4794)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:587)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
            at android.app.Activity.setContentView(Activity.java:1867)
            at com.seedxyx.noteinfingers.activity.OnePageAty.onCreate(OnePageAty.java:92)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
            at android.app.ActivityThread.access$600(ActivityThread.java:133)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4794)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.OutOfMemoryError
            at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
            at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
            at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
            at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
            at android.content.res.Resources.loadDrawable(Resources.java:2007)
            at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
            at android.view.View.<init>(View.java:3336)
            at android.view.ViewGroup.<init>(ViewGroup.java:427)
            at android.widget.FrameLayout.<init>(FrameLayout.java:101)
            at android.widget.ScrollView.<init>(ScrollView.java:158)
            at android.widget.ScrollView.<init>(ScrollView.java:154)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:587)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
            at android.app.Activity.setContentView(Activity.java:1867)
            at com.seedxyx.noteinfingers.activity.OnePageAty.onCreate(OnePageAty.java:92)
            at android.app.Activity.performCreate(Activity.java:5008)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
            at android.app.ActivityThread.access$600(ActivityThread.java:133)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4794)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)

在xml中没有报错啊,运行时在加载这个acvivity时就进不去了.....

  • 写回答

1条回答 默认 最新

  • bdmh 移动开发领域优质创作者 2015-09-13 05:20
    关注

    有可能缺少某种资源,找不到,无法渲染,你一个一个属性的去掉,看看去掉哪个就可以正常渲染布局了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 设计数字电路得到要求结果
  • ¥15 hfss 组天线阵列报错:The A and B vectors must be parallel to the XY plane,如何解决?
  • ¥30 ansible连接设备报错
  • ¥60 pmsampsize包取值问题
  • ¥15 波形合成电路的设计学习
  • ¥15 unity脚本挂不上
  • ¥15 数学建模数学建模需要
  • ¥20 Java Sound Api 调用Mixer.getLine偶现Line unsupported错误。
  • ¥15 使用cuda加速opencv运算但是报错AttributeError: module 'cv2.cuda' has no attribute 'getCudaEnabledDeviceCount'
  • ¥15 java输入输出异常