我正在開發一個定製的列表視圖,在我的Android應用程序中有圖像和文本視圖,但是,我完全按照此鏈接中的教程: http://theopentutorials.com/tutorials/android/listview/android-custom-listview-with-image-and-text-using-baseadapter/#Project_Folder_Structure 。當我指向放置在可繪製文件中的圖像時,我在ListActivity類中遇到了一個問題,這裏是我的代碼: package com.Android.mysmartrecipeassistant;使用BaseAdabter自定義ListView
import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
public class BookListActivity extends Activity implements OnItemClickListener
{
public static final String[] recTitles = new String[] { "Cheese Salad",
"Burger and Fries", "Chicken", "Sandwiches", "Potato Sauce" };
public static final Integer[] recImgs = new Integer[] {R.drawable.recipe, R.drawable.salad};
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
}
}
我的問題出在下面一行:
public static final Integer[] recImgs = new Integer[] {R.drawable.recipe, R.drawable.salad};
雖然我把圖像的繪製,我的代碼沒有看到這些圖片,並指出錯誤(圖像不能得到解決或者是不是字段)
無論如何,我還沒有完成這個類的代碼。你能幫我解決這個問題嗎?