gpt4 book ai didi

android - 使用滚动按钮时应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 01:46:40 30 4
gpt4 key购买 nike

<分区>

编辑:明确重复

当我尝试对我的布局调用setContentView() 方法时,我的应用程序崩溃了。

我尝试了一些解决方案,当我删除按钮的样式时,错误消失了。

这似乎是我为按钮使用的样式导致的。

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/lights_over" />
<item android:state_focused="true" android:drawable="@drawable/lights_over" />
<item android:state_selected = "true" android:drawable = "@drawable/lights_over" />
<item android:drawable = "@drawable/lights" android:id="@+id/button_L"/>
</selector>

我的日志

01-09 12:04:24.161: D/dalvikvm(20682): GC_BEFORE_OOM freed 9K, 5% free 122880K/129056K, paused 20ms, total 20ms
01-09 12:04:24.161: E/dalvikvm-heap(20682): Out of memory on a 9027940-byte allocation.
01-09 12:04:24.171: E/AndroidRuntime(20682): FATAL EXCEPTION: main
01-09 12:04:24.171: E/AndroidRuntime(20682): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidexample.broadcastreceiver/com.androidexample.broadcastreceiver.StartMenu}: android.view.InflateException: Binary XML file line #79: Error inflating class <unknown>
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2296)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread.access$700(ActivityThread.java:151)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.os.Handler.dispatchMessage(Handler.java:99)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.os.Looper.loop(Looper.java:137)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread.main(ActivityThread.java:5293)
01-09 12:04:24.171: E/AndroidRuntime(20682): at java.lang.reflect.Method.invokeNative(Native Method)
01-09 12:04:24.171: E/AndroidRuntime(20682): at java.lang.reflect.Method.invoke(Method.java:511)
01-09 12:04:24.171: E/AndroidRuntime(20682): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
01-09 12:04:24.171: E/AndroidRuntime(20682): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
01-09 12:04:24.171: E/AndroidRuntime(20682): at dalvik.system.NativeStart.main(Native Method)
01-09 12:04:24.171: E/AndroidRuntime(20682): Caused by: android.view.InflateException: Binary XML file line #79: Error inflating class <unknown>
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.createView(LayoutInflater.java:619)
01-09 12:04:24.171: E/AndroidRuntime(20682): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:666)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.rInflate(LayoutInflater.java:760)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
01-09 12:04:24.171: E/AndroidRuntime(20682): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:327)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.Activity.setContentView(Activity.java:1928)
01-09 12:04:24.171: E/AndroidRuntime(20682): at com.androidexample.broadcastreceiver.StartMenu.onCreate(StartMenu.java:20)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.Activity.performCreate(Activity.java:5250)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2210)
01-09 12:04:24.171: E/AndroidRuntime(20682): ... 11 more
01-09 12:04:24.171: E/AndroidRuntime(20682): Caused by: java.lang.reflect.InvocationTargetException
01-09 12:04:24.171: E/AndroidRuntime(20682): at java.lang.reflect.Constructor.constructNative(Native Method)
01-09 12:04:24.171: E/AndroidRuntime(20682): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.LayoutInflater.createView(LayoutInflater.java:593)
01-09 12:04:24.171: E/AndroidRuntime(20682): ... 25 more
01-09 12:04:24.171: E/AndroidRuntime(20682): Caused by: java.lang.OutOfMemoryError
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:817)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.content.res.Resources.loadDrawable(Resources.java:2854)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.content.res.Resources.getDrawable(Resources.java:1521)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:921)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:858)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.content.res.Resources.loadDrawable(Resources.java:2839)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.view.View.<init>(View.java:3460)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.widget.TextView.<init>(TextView.java:791)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.widget.Button.<init>(Button.java:107)
01-09 12:04:24.171: E/AndroidRuntime(20682): at android.widget.Button.<init>(Button.java:103)
01-09 12:04:24.171: E/AndroidRuntime(20682): ... 28 more

有谁知道如何解决这个问题?

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com