2015-10-15 79 views
0

当应用程序更改布局时,出现此错误。图像的分辨率与其他布局很好,但是当涉及到这个特定的布局时,它会崩溃。我试着用一个简单的设计,只有布局的颜色,没有任何崩溃。因此,我想知道这是一个记忆问题还是解决问题。请注意,我是一个缺乏经验的Android工作室用户,我将不胜感激,如果你能对这个问题提出建议和时是否有任何解决方案二进制XML文件,错误膨胀类,是什么问题?

的logcat:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fluke.kgwee.flukegame/com.fluke.kgwee.flukegame.endactivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class <unknown> 
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) 
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
     at android.os.Handler.dispatchMessage(Handler.java:102) 
     at android.os.Looper.loop(Looper.java:148) 
     at android.app.ActivityThread.main(ActivityThread.java:5417) 
     at java.lang.reflect.Method.invoke(Native Method) 
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

应用程序崩溃之前布局:

<ViewFlipper 
    android:layout_width="match_parent" 
    android:layout_height="120dp" 
    android:id="@+id/viewFlipper" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="175dp"> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="30dp" 
     android:gravity="center_horizontal"> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/imageView" 
      android:background="@drawable/pq1" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" /> 
    </LinearLayout> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="30dp" 
     android:gravity="center_horizontal"> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/imageView2" 
      android:background="@drawable/pq2" 
      android:layout_alignStart="@+id/imageView" /> 
    </LinearLayout> 
</ViewFlipper> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="135dp" 
    android:layout_marginTop="160dp"> 

    <ImageButton 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:id="@+id/Prev" 
     android:background="@drawable/leftarrow" 
     android:layout_marginLeft="25dp" 
     android:layout_marginTop="55dp" 
     android:contentDescription="@string/buttonPrev" /> 

    <ImageButton 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:id="@+id/Next" 
     android:background="@drawable/arrow" 
     android:layout_marginLeft="230dp" 
     android:layout_marginTop="55dp" 
     android:contentDescription="@string/buttonNext" 
     android:clickable="true" /> 

</LinearLayout> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="135dp" 
    android:layout_marginTop="275dp"> 

    <ImageButton 
     android:layout_width="55dp" 
     android:layout_height="55dp" 
     android:id="@+id/imageButton3" 
     android:background="@drawable/leftarrow" 
     android:layout_marginLeft="5dp" 
     android:layout_marginTop="55dp" /> 

    <ImageButton 
     android:layout_width="55dp" 
     android:layout_height="55dp" 
     android:id="@+id/imageButton4" 
     android:background="@drawable/arrow" 
     android:layout_marginLeft="230dp" 
     android:layout_marginTop="55dp" /> 
</LinearLayout> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="135dp" 
    android:layout_marginTop="385dp"> 

    <ImageButton 
     android:layout_width="55dp" 
     android:layout_height="55dp" 
     android:id="@+id/imageButton5" 
     android:background="@drawable/leftarrow" 
     android:layout_marginLeft="5dp" 
     android:layout_marginTop="55dp" /> 

    <ImageButton 
     android:layout_width="55dp" 
     android:layout_height="55dp" 
     android:id="@+id/imageButton6" 
     android:background="@drawable/arrow" 
     android:layout_marginLeft="230dp" 
     android:layout_marginTop="55dp" /> 
</LinearLayout> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Scoreboard:" 
    android:textSize="20sp" 
    android:textStyle="bold" 
    android:id="@+id/textView" 
    android:textColor="#010101" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="30dp" /> 

<ImageView 
    android:layout_width="125dp" 
    android:layout_height="125dp" 
    android:id="@+id/imageView13" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" 
    android:background="@drawable/target1" 
    android:layout_marginTop="30dp" /> 

+0

你可以发表你的XML –

+0

完成。发布,解决问题的任何解决方案? – Kendrick

+0

查看整个堆栈跟踪,包括嵌套的“由...引发”异常。 – laalto

回答

0

这似乎是OutOfMemoryError。检查是否如果要加载在你的XM大的位图L和摆脱的那个或妥善管理

0

雅的答案是正确的,以避免尝试在设备上运行的应用程序不是在模拟器, 把较小尺寸的图像中绘制文件夹

+0

但是应用程序小于100kb的活动的背景并且完美工作的背景超过100kb。 – Kendrick

相关问题