Android列表视图,日期,得到标记

时间:2013-06-10 15:00:29

标签: android listview android-listview

我需要一些关于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;

        }

1 个答案:

答案 0 :(得分:0)

隐藏过去日期添加到您的适配器

@Override
public boolean isEnabled(int position) {
      return !DateHelper.isDateOlderThanNow((String)mStringArray[position]); // condition here  
}