Android 为listview设置背景可绘制时应用程序崩溃

Android 为listview设置背景可绘制时应用程序崩溃,android,listview,Android,Listview,嗨,在我的应用程序的一个活动中,有一个列表视图,该列表视图有一个自定义行,我使用数组适配器和内容设置器将数据放入该列表视图。我的问题是,当我为该列表视图设置背景图像时,我的应用程序崩溃。我使用android:background=“@drawable/ic_bg4”设置背景图像。我将此代码添加到活动相关布局和列表视图中。我还尝试使用lv.setBackgroundResource(R.drawable.ic_bg4)动态设置背景图像(lv为列表视图),但应用程序再次崩溃。有人知道怎么做吗 编辑

嗨,在我的应用程序的一个活动中,有一个列表视图,该列表视图有一个自定义行,我使用数组适配器和内容设置器将数据放入该列表视图。我的问题是,当我为该列表视图设置背景图像时,我的应用程序崩溃。我使用
android:background=“@drawable/ic_bg4”
设置背景图像。我将此代码添加到活动相关布局和列表视图中。我还尝试使用
lv.setBackgroundResource(R.drawable.ic_bg4)动态设置背景图像(lv为列表视图),但应用程序再次崩溃。有人知道怎么做吗

编辑

主布局的代码

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main"
android:id="@+id/main_defLayout">



<ListView
    android:divider="@null"
    android:background="@drawable/ic_bg4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/list"
    tools:listitem="@layout/main_row"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

    </RelativeLayout>

这是我的自定义行代码

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

<LinearLayout
    android:orientation="vertical"
    android:background="#D9000000"
    android:layout_width="match_parent"
    android:layout_height="235dp"
    android:weightSum="1"
    android:id="@+id/main_row_linearLayout">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="180dp"
    android:id="@+id/main_row_cover"
    android:scaleType="fitXY" />

<TextView
    android:layout_marginLeft="5dp"
    android:textColor="#fff"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:id="@+id/main_row_artistName" />

<TextView
    android:layout_marginLeft="5dp"
    android:textColor="#fff"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:id="@+id/main_row_songName"
    android:layout_marginTop="-3dp" />

</LinearLayout>


请发布您的日志,可能是sry i的副本,我是android新手,我不知道什么是日志猫,以及如何为您获取和发送。在问这个问题之前,我看到了Zahan Safallwa,正如我在问题中所说,我尝试过的,您的图像大小是多少?这可能是因为高分辨率的图像