gpt4 book ai didi

java - 我的选项卡中的自定​​义 PNG 背景,Android 应用程序,(无法理解 logcat)

转载 作者:行者123 更新时间:2023-12-01 05:12:11 24 4
gpt4 key购买 nike

虽然现在看来我有一个按钮失败,但目前没有背景,所以我将粘贴一些代码。

并且不知道为什么我遇到这个问题,所以我开始删除我试图从中获取背景的内容,现在我似乎无法理解现在的问题是什么。该应用程序刚刚崩溃了。在我解决了这个问题之后,主要问题是在所有选项卡中获得相同的背景。

如果您想要我的代码的任何其他部分,请告诉我。

08-08 20:54:11.798: D/dalvikvm(521): GC_EXTERNAL_ALLOC freed 41K, 53% free 2550K/5379K, external 1625K/2137K, paused 175ms

08-08 20:54:17.309: D/dalvikvm(552): GC_EXTERNAL_ALLOC freed 42K, 53% free 2550K/5379K, external 1625K/2137K, paused 119ms

08-08 20:54:21.169: D/dalvikvm(552): GC_EXTERNAL_ALLOC freed 6K, 53% free 2568K/5379K, external 7485K/9347K, paused 33ms

08-08 20:54:21.549: D/dalvikvm(552): GC_EXTERNAL_ALLOC freed 3K, 53% free 2569K/5379K, external 16274K/18322K, paused 27ms

08-08 20:54:21.599: D/dalvikvm(552): GC_EXTERNAL_ALLOC freed 0K, 53% free 2569K/5379K, external 16274K/18322K, paused 31ms

08-08 20:54:21.719: I/dalvikvm-heap(552): Clamp target GC heap from 25.509MB to 24.000MB

08-08 20:54:21.739: D/dalvikvm(552): GC_FOR_MALLOC freed 0K, 53% free 2569K/5379K, external 18899K/20947K, paused 45ms

08-08 20:54:22.050: D/dalvikvm(552): GC_EXTERNAL_ALLOC freed <1K, 53% free 2573K/5379K, external 18899K/20947K, paused 32ms

08-08 20:54:22.069: E/dalvikvm-heap(552): 9000000-byte external allocation too large for this process.

08-08 20:54:22.169: I/dalvikvm-heap(552): Clamp target GC heap from 25.512MB to 24.000MB

08-08 20:54:22.169: E/GraphicsJNI(552): VM won't let us allocate 9000000 bytes

08-08 20:54:22.179: D/dalvikvm(552): GC_FOR_MALLOC freed 0K, 53% free 2573K/5379K, external 18899K/20947K, paused 36ms

08-08 20:54:22.179: D/skia(552): --- decoder->decode returned false

08-08 20:54:22.179: D/AndroidRuntime(552): Shutting down VM

08-08 20:54:22.179: W/dalvikvm(552): threadid=1: thread exiting with uncaught exception (group=0x40015560)

08-08 20:54:22.199: E/AndroidRuntime(552): FATAL EXCEPTION: main

**08-08 20:54:22.199: E/AndroidRuntime(552): java.lang.RuntimeException: Unable to start activity ComponentInfo{taxi.allians/taxi.allians.Tabs}: android.view.InflateException: Binary XML file line #45: Error inflating class android.widget.Button**

08-08 20:54:22.199: E/AndroidRuntime(552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)

08-08 20:54:22.199: E/AndroidRuntime(552): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)

08-08 20:54:22.199: E/AndroidRuntime(552): at android.app.ActivityThread.access$1500(ActivityThread.java:117)

08-08 20:54:22.199: E/AndroidRuntime(552): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)

08-08 20:54:22.199: E/AndroidRuntime(552): at android.os.Handler.dispatchMessage(Handler.java:99)

08-08 20:54:22.199: E/AndroidRuntime(552): at android.os.Looper.loop(Looper.java:123)

这是我的 tabs.xml 中的一些 XML 代码:

    <Button
android:id="@+id/bRingTaxi"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="center"
android:layout_y = "50dp"
android:background= "@drawable/button_custom_callcab"
android:textSize="40dp" />
</LinearLayout>

button_custom_callcab 出现在这里:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/callbutton_pressed"
android:state_pressed="true" />
<item android:drawable="@drawable/callbutton_pressed"
android:state_focused="true" />
<item android:drawable="@drawable/callbutton_un_pressed" />
</selector>

这是我尝试获取背景的部分。这是在 tabs.xml 文件中:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/carbonfibre"
>

所以我希望你能帮助我理解这个logcat。如何获得正确的背景?

最佳答案

图像尺寸太大。减小大小并重试。

关于java - 我的选项卡中的自定​​义 PNG 背景,Android 应用程序,(无法理解 logcat),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11873212/

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