我有这个代码,但我遇到了问题。该应用程序很遗憾地关闭了,我不知道此代码中的问题是什么。
我的XML文件包含多个ImageView,但我不知道它为什么关闭...是不是有可能有很多ImageView?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/a" />
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/b"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/c"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/d"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/e"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/f"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/g"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/h"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/i"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/j"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/k"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/l"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/m"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/n"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/o"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/p"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/q"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/r"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/s"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/t"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/u"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/v"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/w"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/x"/>
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/y"/>
</LinearLayout>
</ScrollView>
这里是LogCat:
03-12 11:37:55.481: E/AndroidRuntime(879): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thesis.americansignlanguage/com.thesis.americansignlanguage.AlphabetTutorial}: android.view.InflateException: Binary XML file line #101: Error inflating class <unknown>
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.os.Handler.dispatchMessage(Handler.java:99)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.os.Looper.loop(Looper.java:137)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-12 11:37:55.481: E/AndroidRuntime(879): at java.lang.reflect.Method.invokeNative(Native Method)
03-12 11:37:55.481: E/AndroidRuntime(879): at java.lang.reflect.Method.invoke(Method.java:511)
03-12 11:37:55.481: E/AndroidRuntime(879): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 11:37:55.481: E/AndroidRuntime(879): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 11:37:55.481: E/AndroidRuntime(879): at dalvik.system.NativeStart.main(Native Method)
03-12 11:37:55.481: E/AndroidRuntime(879): Caused by: android.view.InflateException: Binary XML file line #101: Error inflating class <unknown>
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-12 11:37:55.481: E/AndroidRuntime(879): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-12 11:37:55.481: E/AndroidRuntime(879): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.Activity.setContentView(Activity.java:1881)
03-12 11:37:55.481: E/AndroidRuntime(879): at com.thesis.americansignlanguage.AlphabetTutorial.onCreate(AlphabetTutorial.java:12)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.Activity.performCreate(Activity.java:5104)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-12 11:37:55.481: E/AndroidRuntime(879): ... 11 more
03-12 11:37:55.481: E/AndroidRuntime(879): Caused by: java.lang.reflect.InvocationTargetException
03-12 11:37:55.481: E/AndroidRuntime(879): at java.lang.reflect.Constructor.constructNative(Native Method)
03-12 11:37:55.481: E/AndroidRuntime(879): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-12 11:37:55.481: E/AndroidRuntime(879): ... 25 more
03-12 11:37:55.481: E/AndroidRuntime(879): Caused by: java.lang.OutOfMemoryError
03-12 11:37:55.481: E/AndroidRuntime(879): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.content.res.Resources.loadDrawable(Resources.java:1965)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.widget.ImageView.<init>(ImageView.java:120)
03-12 11:37:55.481: E/AndroidRuntime(879): at android.widget.ImageView.<init>(ImageView.java:110)
03-12 11:37:55.481: E/AndroidRuntime(879): ... 28 more
03-12 11:37:57.390: I/Process(879): Sending signal. PID: 879 SIG: 9
03-12 11:37:58.420: E/Trace(949): error opening trace file: No such file or directory (2)