[绿色和红色图像应该是线性的,必须分别显示为dotColors []中的值。 ]android多次使用图像
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
dotColors = datasource.getColorsArrayForWeek(tasks.get(position).getId(), call.get(Calendar.DAY_OF_YEAR));
LinearLayout tlli = (LinearLayout)v;
jj=0;
jj=0;
while(jj<7)
{
if(dotColors[jj]==0)
{
red=(ImageView) tlli.findViewById(R.id.day1);
}
else if(dotColors[jj]==1)
{
green=(ImageView) tlli.findViewById(R.id.day2);
}
jj++;
Log.i("jj::" +jj," ");
}
return v;
}
查询数据库后,数值存储在dotColors []中。 dotColors []包含整数元素,其值仅为0 and 1..
如果值为0
我必须显示"red"
图像,如果它的1
我必须显示"green"
图像。我怎么能实现它? 希望现在的解释更清晰图像
每次你用day1初始化ImageView? –
红色和绿色具有相同的图像引用..你想实现什么,你想要改变基于jj值的imageview图像..? – Pragnani
这会发生得如此之快,你只能看到'jj = 76'的结果。你究竟想要达到什么目标? – SudoRahul