我将以下代码用于动态 ListView。我需要在 ListView 的文本中添加一些图像
ListView listView = (ListView) menu.findViewById(R.id.list);
initListView(this, listView, "", 5, android.R.layout.simple_list_item_1);
public void initListView(Context context, ListView listView, String prefix, int numItems, int layout) {
// By using setAdpater method in listview we an add string array in list.
String[] arr ={"A","B","C","D","E"};
listView.setAdapter(new ArrayAdapter<String>(context, layout, arr));
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
请让我知道如何在我的代码中添加图像。