使用Drawable xml在Android上出现奇怪的启动崩溃

时间:2013-05-04 03:34:14

标签: android android-layout android-emulator android-drawable

我有这个奇怪的问题,如果我尝试将Drawable xml文件分配给布局文件,那么应用程序崩溃了。但是,如果我使用标准颜色代码,它可以正常工作。

请注意。我几乎使用模板Master / Detail Flow作为新的,我还在基本布局的Root视图上分配了一个xml drawable,它工作正常。问题是将Drawable xml分配到列表片段的布局(list_content.xml)

这是我的背景xml

<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
    android:startColor="#FF000000"
    android:endColor="#FF555555"
    android:type="linear"
    />
</shape>

我的布局是

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@drawable/background_lhs"
    >

<LinearLayout android:id="@+id/progressContainer"
        android:orientation="vertical"
        android:layout_width="match_parent" 
        android:layout_height="match_parent"
        android:visibility="gone"
        android:gravity="center" >

    <ProgressBar style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    <TextView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="Loading"
            android:paddingTop="4dip"
            android:singleLine="true" />

</LinearLayout>

<FrameLayout android:id="@+id/listContainer"
        android:layout_width="match_parent" 
        android:layout_height="match_parent"

        >

    <ListView android:id="@android:id/list"
            android:layout_width="match_parent" 
            android:layout_height="match_parent"
            android:drawSelectorOnTop="false" 

            />
    <TextView android:id="@+id/internalEmpty"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textAppearance="?android:attr/textAppearanceLarge" />
</FrameLayout>

</FrameLayout>

^在最顶部你会找到backgrounds引用,当我将其更改为正常值(例如#000000)时,它可以工作。我也尝试过将纯色作为可绘制xml中的形状,这仍然会导致崩溃。除了Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 2521之外,log cat几乎没有帮助。没有明显的迹象告诉我logcat中的错误,也没有内存警告或错误。

这是请求的logcat

05-04 07:03:58.510: D/dalvikvm(1718): Not late-enabling CheckJNI (already on)
05-04 07:03:58.520: E/Trace(1718): error opening trace file: No such file or directory (2)
05-04 07:03:58.520: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:03:58.520: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:03:58.520: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:03:58.520: W/ActivityThread(1718): Application com.td3.testapp is waiting for the debugger on port 8100...
05-04 07:03:58.520: I/System.out(1718): Sending WAIT chunk
05-04 07:03:59.173: I/dalvikvm(1718): Debugger is active
05-04 07:03:59.350: I/System.out(1718): Debugger has connected
05-04 07:03:59.350: I/System.out(1718): waiting for debugger to settle...
05-04 07:03:59.560: I/System.out(1718): waiting for debugger to settle...
05-04 07:03:59.764: I/System.out(1718): waiting for debugger to settle...
05-04 07:03:59.970: I/System.out(1718): waiting for debugger to settle...
05-04 07:04:00.173: I/System.out(1718): waiting for debugger to settle...
05-04 07:04:00.383: I/System.out(1718): waiting for debugger to settle...
05-04 07:04:00.594: I/System.out(1718): waiting for debugger to settle...
05-04 07:04:00.800: I/System.out(1718): waiting for debugger to settle...
05-04 07:04:01.013: I/System.out(1718): debugger has settled (1362)
05-04 07:04:01.013: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.013: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.040: D/dalvikvm(1718): GC_FOR_ALLOC freed 94K, 8% free 2508K/2720K, paused 1ms, total 2ms
05-04 07:04:01.071: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.090: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.100: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.100: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.120: D/libEGL(1718): loaded /system/lib/egl/libEGL_emulation.so
05-04 07:04:01.120: D/(1718): HostConnection::get() New Host Connection established 0xb9518330, tid 1718
05-04 07:04:01.140: D/libEGL(1718): loaded /system/lib/egl/libGLESv1_CM_emulation.so
05-04 07:04:01.140: D/libEGL(1718): loaded /system/lib/egl/libGLESv2_emulation.so
05-04 07:04:01.201: W/EGL_emulation(1718): eglSurfaceAttrib not implemented
05-04 07:04:01.220: D/OpenGLRenderer(1718): Enabling debug mode 0
05-04 07:04:01.220: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.231: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.231: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.231: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.231: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.241: W/Trace(1718): Unexpected value from nativeGetEnabledTags: 0
05-04 07:04:01.251: A/libc(1718): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread        1718 (.td3.testapp)

1 个答案:

答案 0 :(得分:0)

在本网站内遇到​​另一个问题后,问及&#34;错误打开跟踪文件:没有这样的文件或目录(2)&#34;那里有一个答案似乎意外地解决了我的问题。我评论的那一刻     <uses-sdk /> 这一切都是突然开始工作,然后即使我删除了那条评论它继续工作,所以我不知道这是一个错误还是以某种方式重置了一些东西,但我没有做任何其他事情,只能解决我的问题。