我需要一些关于 android 的 listview 的帮助。在这个任务上有点股票。我想要做的是列出所有日期,它已经完成。但是当一个日期过去时,我仍然想列出日期但想要褪色。获得列表和日期排序的功能。但我不知道如何让过去的一天褪色。我想在我的 getview 上执行此操作。我无法获取日期位置并在传递的日期上设置颜色。
public View getView(int position, View convertView, ViewGroup parent) {
View hView = convertView;
// Iterator<String> it = startSubEvents.iterator();
// String eachDate = "";
if(convertView == null){
//2013-06-25 12:00
hView = mInflater.inflate(R.layout.sub_event_form, parent, false);
holder = new ViewHolder();
holder.imageHolder = (ImageView) hView.findViewById(R.id.fbsmallImage);
holder.text_holder_subText = (TextView) hView.findViewById(R.id.sub_text);
holder.long_des_holder = (TextView) hView.findViewById(R.id.long_des_boder);
holder.text_holder_for_eventName = (TextView) hView.findViewById(R.id.fbFriendName);
holder.startSubEventHolder = (TextView) hView.findViewById(R.id.dateSubEvent);
holder.text_holder_for_eventName.setText(friendName.get(position).toString());
holder.text_holder_subText.setText(sub_text_for_events.get(position).toString());
holder.startSubEventHolder.setText(startSubEvents.get(position).toString());
holder.long_des_holder.setText(event_long_des.get(position).toString());
holder.long_des_holder.setVisibility(hView.GONE);
hView.setTag(holder);
holder.position = position ;
int id_for_event_image = context.getResources().getIdentifier("image_" + friendPic.get(position), "drawable", "com.test");
Drawable res_type_image = context.getResources().getDrawable(id_for_event_image);
holder.imageHolder.setImageDrawable(res_type_image);
Object[] mStringArray = startSubEvents.toArray();
for(int i = 0; i < mStringArray.length ; i++){
if(DateHelper.isDateOlderThenNow((String)mStringArray[i])){
String s = mStringArray[position].toString();
}
}
}
return hView;
}