簡體   English   中英

如何在Android的ListView中添加圖像?

[英]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

謝謝

真? 因為快速的Google搜索打開了此博客條目 ,我認為這與我用於Android應用程序的博客條目相同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM