@Override public View getView(int position, View convertView, ViewGroup parent) { NewsHolder holder = null; View row = convertView; holder = null; cd1 = new ConnectionDetector(context); if (row == null) { row = inflater.inflate(R.layout.my_prev_work_trip_row_item, null); holder = new NewsHolder(); holder.trip_name = (TextView) row.findViewById(R.id.trip_name); holder.list_row = (LinearLayout) row.findViewById(R.id.list_row); row.setTag(holder); } else { holder = (NewsHolder) row.getTag(); } PrevWorkTripDataType itemdata = data.get(position); holder.trip_name.setText(itemdata.getVacation_name()); // if (APP_DATA.vacation_success.equals("1")){ // // holder.list_row.setBackgroundColor(Color.parseColor("#E1E1E1")); // } list_id = itemdata.getVacation_id(); int total_d = data.size(); // if (APP_DATA.loadmore==1) // // { // // if (position < total_d) { // cd.loadMore(APP_DATA.last_row); // // } // } return row; }
@Override public View getView(int position, View convertView, ViewGroup parent) { NewsHolder newsHolder; if (convertView == null) { convertView = mInflater.inflate(R.layout.news_list_item, null); newsHolder = new NewsHolder(); newsHolder.tvNewsType = (TextView) convertView.findViewById(R.id.tv_news_type); newsHolder.tvNewsTitle = (TextView) convertView.findViewById(R.id.tv_news_title); newsHolder.tvNewsDate = (TextView) convertView.findViewById(R.id.tv_news_date); convertView.setTag(newsHolder); } else { newsHolder = (NewsHolder) convertView.getTag(); } // 拆分字符串,只取年月日 String[] ss = new String[2]; ss = mNewsList.get(position).getCreatedAt().split(" "); newsHolder.tvNewsType.setText(mNewsList.get(position).getType()); // 新闻类型 newsHolder.tvNewsTitle.setText(mNewsList.get(position).getTitle()); // 新闻标题 newsHolder.tvNewsDate.setText(ss[0]); // 新闻发布日期 return convertView; }