我想在ListView
的行中添加图片,这是我的代码:
ListView listViewProducts = (ListView) findViewById(R.id.listViewProducts);
ImageView iconMeat = (ImageView) findViewById(R.id.iconMeat);
String[] products = getResources().getStringArray(R.array.products);
for (int itemPos = 0; itemPos < listViewProducts.getCount(); itemPos++)
{
if ( products[0].equals(listViewProducts.getItemAtPosition(itemPos)) )
{
//TODO
// In this case to add the image
}
}
由于
答案 0 :(得分:1)
有关在listview中使用适配器的信息,请参阅以下帖子: - https://stackoverflow.com/a/8267165/2035885 http://www.ezzylearning.com/tutorial.aspx?tid=1763429&q=customizing-android-listview-items-with-custom-arrayadapter http://www.mkyong.com/android/android-listview-example/
请执行以下操作: -