[英]how do I add an image to my listview in android?
我有一個listview,其中有2個textview,這些視圖由數據庫使用簡單的光標適配器填充。 我想在列表中的每個項目內添加一個圖像,並從數據庫中添加相應的圖像。 我已經搜索了有關該主題的內容,但尚未找到解決方案。 任何幫助將不勝感激
String[] from = new String[]{InventoryDbAdapter.KEY_TITLE, InventoryDbAdapter.KEY_DESCRIPTION};
// and an array of the fields we want to bind those fields to (in this case just text1)
int[] to = new int[]{R.id.text1,R.id.text2};
// Now create a simple cursor adapter and set it to display
SimpleCursorAdapter inventory =
new SimpleCursorAdapter(this, R.layout.row, InventoryCursor, from, to);
setListAdapter(inventory
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.