<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center"
android:background="@drawable/background1">
<ImageButton
android:id="@+id/make"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/button1" >
</ImageButton>
<ImageButton
android:id="@+id/see"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/button2" >
</ImageButton>
它的三个非常小的 JPEGS 一个是背景,另外两个是按钮,我知道我得到一个运行时错误,但是当我删除 LinearLayout 的 android:background 时它运行正常,我做错了什么?
11-27 23:25:37.464: D/dalvikvm(422): GC_EXTERNAL_ALLOC freed 49K, 50% free 2742K/5379K, external 1625K/2137K, paused 74ms
11-27 23:25:38.624: D/dalvikvm(422): GC_EXTERNAL_ALLOC freed 2K, 50% free 2740K/5379K, external 12425K/14473K, paused 99ms
11-27 23:25:38.674: E/dalvikvm-heap(422): 22118400-byte external allocation too large for this process.
11-27 23:25:38.734: E/GraphicsJNI(422): VM won't let us allocate 22118400 bytes
11-27 23:25:38.734: D/dalvikvm(422): GC_FOR_MALLOC freed 0K, 50% free 2740K/5379K, external 12425K/14473K, paused 44ms
11-27 23:25:38.744: D/AndroidRuntime(422): Shutting down VM
11-27 23:25:38.744: W/dalvikvm(422): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-27 23:25:38.784: E/AndroidRuntime(422): FATAL EXCEPTION: main
11-27 23:25:38.784: E/AndroidRuntime(422): java.lang.RuntimeException: Unable to start activity ComponentInfo{genie.lamp.rub/genie.lamp.rub.FirstScreen}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.os.Looper.loop(Looper.java:130)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-27 23:25:38.784: E/AndroidRuntime(422): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 23:25:38.784: E/AndroidRuntime(422): at java.lang.reflect.Method.invoke(Method.java:507)
11-27 23:25:38.784: E/AndroidRuntime(422): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-27 23:25:38.784: E/AndroidRuntime(422): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-27 23:25:38.784: E/AndroidRuntime(422): at dalvik.system.NativeStart.main(Native Method)
11-27 23:25:38.784: E/AndroidRuntime(422): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
11-27 23:25:38.784: E/AndroidRuntime(422): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java: 56)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
11-27 23:25:38.784: E/AndroidRuntime(422): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.Activity.setContentView(Activity.java:1657)
11-27 23:25:38.784: E/AndroidRuntime(422): at genie.lamp.rub.FirstScreen.onCreate(FirstScreen.java:16)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-27 23:25:38.784: E/AndroidRuntime(422): ... 11 more
11-27 23:25:38.784: E/AndroidRuntime(422): Caused by: java.lang.reflect.InvocationTargetException
11-27 23:25:38.784: E/AndroidRuntime(422): at java.lang.reflect.Constructor.constructNative(Native Method)
11-27 23:25:38.784: E/AndroidRuntime(422): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
11-27 23:25:38.784: E/AndroidRuntime(422): ... 21 more
11-27 23:25:38.784: E/AndroidRuntime(422): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.Bitmap.nativeCreate(Native Method)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.content.res.Resources.loadDrawable(Resources.java:1709)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.View.<init>(View.java:1951)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.View.<init>(View.java:1899)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.view.ViewGroup.<init>(ViewGroup.java:286)
11-27 23:25:38.784: E/AndroidRuntime(422): at android.widget.LinearLayout.<init>(LinearLayout.java:120)
11-27 23:25:38.784: E/AndroidRuntime(422): ... 24 more
11-27 23:25:41.264: I/Process(422): Sending signal. PID: 422 SIG: 9