我在我的佈局中有一個ImageView
,請參閱下面的代碼。當我嘗試設置src
屬性是我的啓動器圖標,我得到以下錯誤:無法解析符號@ drawable/ic_launcher
Cannot resolve symbol '@drawable/ic_launcher'
ic_launcer.png添加到我的文件夾可繪製,見下圖。爲什麼我不能在我的ImageView
中引用我的圖像?
項目結構:
Layout.xml:
<?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:layout_weight="1"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
感謝您解釋'drawable'和'mipmap'文件夾之間的區別。 – Marcus 2015-03-24 21:41:28