Arvin_ghost 2015-09-13 02:23 采纳率: 25%
浏览 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 oracle数据库备份表如何操作
  • ¥15 软件定义网络mininet和onos控制器问题
  • ¥15 微信小程序 用oss下载 aliyun-oss-sdk-6.18.0.min client报错
  • ¥15 ArcGIS批量裁剪
  • ¥15 labview程序设计
  • ¥15 为什么在配置Linux系统的时候执行脚本总是出现E: Failed to fetch http:L/cn.archive.ubuntu.com
  • ¥15 Cloudreve保存用户组存储空间大小时报错
  • ¥15 伪标签为什么不能作为弱监督语义分割的结果?
  • ¥15 编一个判断一个区间范围内的数字的个位数的立方和是否等于其本身的程序在输入第1组数据后卡住了(语言-c语言)