我在名为 simon_button 的 res/drawable 中创建了这个
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:color="#fc000000"/>
<item android:state_enabled="false"
android:color="#fcf60000" />
<item android:color="#fcf60000"/>
</selector>
这是我的按钮代码
<Button
android:id="@+id/red"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_above="@+id/green"
android:background="@drawable/simon_button"
android:layout_marginBottom="7dp"
android:layout_toLeftOf="@+id/CheckedSS"
android:layout_marginRight="0dp"
android:text="" />
谁能告诉我为什么这是强制关闭。当我从这个网站上阅读其他东西时,我一直在改变东西,但这是从 android 网站上复制粘贴的,我仍然强制关闭
02-12 04:31:01.277: D/memalloc(31678): ion: Mapped buffer base:0x5d8a5000 size:3768320 offset:0 fd:62
02-12 04:31:08.265: D/memalloc(31678): ion: Mapped buffer base:0x5dc3d000 size:3768320 offset:0 fd:66
02-12 04:31:08.305: D/memalloc(31678): ion: Mapped buffer base:0x59cc1000 size:147456 offset:0 fd:75
02-12 04:31:08.335: D/memalloc(31678): ion: Unmapping buffer base:0x5d50d000 size:3768320
02-12 04:31:08.335: D/memalloc(31678): ion: Unmapping buffer base:0x5d8a5000 size:3768320
02-12 04:31:08.335: D/memalloc(31678): ion: Unmapping buffer base:0x5d075000 size:3768320
02-12 04:31:08.955: D/memalloc(31678): ion: Mapped buffer base:0x5d075000 size:3768320 offset:0 fd:57
02-12 04:31:08.975: D/memalloc(31678): ion: Unmapping buffer base:0x59cc1000 size:147456
02-12 04:31:09.085: D/memalloc(31678): ion: Mapped buffer base:0x5d50d000 size:3768320 offset:0 fd:60
02-12 04:31:09.216: D/memalloc(31678): ion: Mapped buffer base:0x5d8a5000 size:3768320 offset:0 fd:63
02-12 04:31:09.266: D/memalloc(31678): ion: Unmapping buffer base:0x5d075000 size:3768320
02-12 04:31:09.266: D/memalloc(31678): ion: Unmapping buffer base:0x5d50d000 size:3768320
02-12 04:31:09.266: D/memalloc(31678): ion: Unmapping buffer base:0x5dc3d000 size:3768320
02-12 04:31:10.086: D/memalloc(31678): ion: Mapped buffer base:0x5d075000 size:3768320 offset:0 fd:57
02-12 04:31:10.187: D/memalloc(31678): ion: Mapped buffer base:0x5d50d000 size:3768320 offset:0 fd:60
02-12 04:31:10.287: D/memalloc(31678): ion: Mapped buffer base:0x5dc3d000 size:3768320 offset:0 fd:66
02-12 04:31:10.337: D/memalloc(31678): ion: Unmapping buffer base:0x5d8a5000 size:3768320
02-12 04:31:10.337: D/memalloc(31678): ion: Unmapping buffer base:0x5d075000 size:3768320
02-12 04:31:10.337: D/memalloc(31678): ion: Unmapping buffer base:0x5d50d000 size:3768320
02-12 04:31:11.478: D/memalloc(31678): ion: Mapped buffer base:0x5d075000 size:3768320 offset:0 fd:57
02-12 04:31:11.568: D/memalloc(31678): ion: Mapped buffer base:0x5d50d000 size:3768320 offset:0 fd:60
02-12 04:31:11.668: D/memalloc(31678): ion: Mapped buffer base:0x5d8a5000 size:3768320 offset:0 fd:63
02-12 04:31:11.718: D/memalloc(31678): ion: Unmapping buffer base:0x5dc3d000 size:3768320
02-12 04:31:11.718: D/memalloc(31678): ion: Unmapping buffer base:0x5d075000 size:3768320
02-12 04:31:11.718: D/memalloc(31678): ion: Unmapping buffer base:0x5d50d000 size:3768320
02-12 04:31:12.329: D/memalloc(31678): ion: Mapped buffer base:0x5d075000 size:3768320 offset:0 fd:57
02-12 04:31:12.429: D/memalloc(31678): ion: Mapped buffer base:0x5d50d000 size:3768320 offset:0 fd:60
02-12 04:31:12.489: D/AndroidRuntime(31678): Shutting down VM
02-12 04:31:12.489: W/dalvikvm(31678): threadid=1: thread exiting with uncaught exception (group=0x40c67a68)
02-12 04:31:12.519: E/AndroidRuntime(31678): FATAL EXCEPTION: main
02-12 04:31:12.519: E/AndroidRuntime(31678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.}: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread.access$600(ActivityThread.java:128)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.os.Handler.dispatchMessage(Handler.java:99)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.os.Looper.loop(Looper.java:137)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread.main(ActivityThread.java:4514)
02-12 04:31:12.519: E/AndroidRuntime(31678): at java.lang.reflect.Method.invokeNative(Native Method)
02-12 04:31:12.519: E/AndroidRuntime(31678): at java.lang.reflect.Method.invoke(Method.java:511)
02-12 04:31:12.519: E/AndroidRuntime(31678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
02-12 04:31:12.519: E/AndroidRuntime(31678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
02-12 04:31:12.519: E/AndroidRuntime(31678): at dalvik.system.NativeStart.main(Native Method)
02-12 04:31:12.519: E/AndroidRuntime(31678): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class <unknown>
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
02-12 04:31:12.519: E/AndroidRuntime(31678): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-12 04:31:12.519: E/AndroidRuntime(31678): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.Activity.setContentView(Activity.java:1835)
02-12 04:31:12.519: E/AndroidRuntime(31678): at com..onCreate(SimonSays.java:40)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.Activity.performCreate(Activity.java:4470)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
02-12 04:31:12.519: E/AndroidRuntime(31678): ... 11 more
02-12 04:31:12.519: E/AndroidRuntime(31678): Caused by: java.lang.reflect.InvocationTargetException
02-12 04:31:12.519: E/AndroidRuntime(31678): at java.lang.reflect.Constructor.constructNative(Native Method)
02-12 04:31:12.519: E/AndroidRuntime(31678): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
02-12 04:31:12.519: E/AndroidRuntime(31678): ... 24 more
02-12 04:31:12.519: E/AndroidRuntime(31678): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/simon_button.xml from drawable resource ID #0x7f020005
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.content.res.Resources.loadDrawable(Resources.java:1956)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.view.View.<init>(View.java:2834)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.widget.TextView.<init>(TextView.java:565)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.widget.Button.<init>(Button.java:108)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.widget.Button.<init>(Button.java:104)
02-12 04:31:12.519: E/AndroidRuntime(31678): ... 27 more
02-12 04:31:12.519: E/AndroidRuntime(31678): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:178)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:869)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:806)
02-12 04:31:12.519: E/AndroidRuntime(31678): at android.content.res.Resources.loadDrawable(Resources.java:1953)
02-12 04:31:12.519: E/AndroidRuntime(31678): ... 32 more
02-12 04:31:12.569: D/dalvikvm(31678): GC_CONCURRENT freed 3874K, 21% free 19070K/23907K, paused 1ms+12ms
02-12 04:36:49.844: I/Process(31678): Sending signal. PID: 31678 SIG: 9