Java ListActivity中的项目

Java ListActivity中的项目,java,android,Java,Android,在我的ListActivity中,我有三个可单击的不同选项。在我的“row.xml”中,我放置了一个ImageView,但不确定如何将其实现到我的活动中,以便每个可选项都有一个不同的图像。它会是另一个适配器吗 这是我的清单 public class StreamCasts extends ListActivity { private static final String[] items={ "item1", "item2", "item3" }; public void

在我的ListActivity中,我有三个可单击的不同选项。在我的“row.xml”中,我放置了一个ImageView,但不确定如何将其实现到我的活动中,以便每个可选项都有一个不同的图像。它会是另一个适配器吗

这是我的清单

public class StreamCasts extends ListActivity {
    private static final String[] items={ "item1", "item2", "item3"
    };
    public void onCreate(Bundle icicle){
        super.onCreate(icicle);
        setContentView(R.layout.heroselect);
        setListAdapter(new ArrayAdapter<String>(this,
                R.layout.row, R.id.label,
                items));
    }
public类StreamCasts扩展ListActivity{
私有静态最终字符串[]items={“item1”、“item2”、“item3”
};
创建公共空间(捆绑冰柱){
超级冰柱;
setContentView(R.layout.heroselect);
setListAdapter(新阵列适配器)(此,
R.layout.row,R.id.label,
(项目);;
}

您需要创建一个自定义的ArrayAdapter,用于自定义覆盖的getView上返回的视图

看一看,但对“CustomArrayAdapter”的一般搜索将为您提供开始

习惯它,因为这是一种非常常见的模式,具有复杂的列表视图。

看看这个。