的列表視圖代碼如下:如何爲這個listView代碼實現ImageAdapter?
public final static String ITEM_TITLE = "title";
public final static String ITEM_CAPTION = "caption";
public Resources resources;
public static Uri path;
public static File file;
public static ProgressDialog m_progressDialog;
public static ListView list;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
// create our list and custom adapter
SeparatedListAdapter adapter = new SeparatedListAdapter(this);
adapter.addSection("Local documents:", new ArrayAdapter<String>(this,
R.layout.list_item, new String[] { "WindowsONE Mobile PK", "WindowsorONE Moldings","Filet for a burger video" }));
adapter.addSection("Non-local resources:", new ArrayAdapter<String>(this,
R.layout.list_item, new String[] { "Launch Photo slideshow link", "Dealer locator link" }));
adapter.addSection("Send emails:", new ArrayAdapter<String>(this,
R.layout.list_item, new String[] { "Send Dealer Locator email", "Send Catalog email","Send install instrucation link" }));
//For extra Information in Listview
//adapter.addSection("Non-local resources:", new SimpleAdapter(this, security, R.layout.list_complex,
//new String[] { ITEM_TITLE, ITEM_CAPTION }, new int[] { R.id.list_complex_title, R.id.list_complex_caption }));
list = getListView();
list.setAdapter(adapter);
list.setTextFilterEnabled(true);
list.setOnItemClickListener(this);
}
}
意味着你要實現帶圖像的ListView? –
不,不含圖像。但我想爲此列表視圖設置ImageAdapter,因爲在我的代碼中,當我要選擇任何列表視圖時,它不會顯示列表項被選中。我的意思是它沒有顯示在該特定索引的背景上選擇了橙色。 –
如果你有答案,請標記正確的答案 – MorningGlory