| | |
| | | import android.widget.BaseAdapter; |
| | | import android.widget.TextView; |
| | | |
| | | import com.yeshi.buwanshequ.R; |
| | | import com.weikou.beibeivideo.R; |
| | | |
| | | |
| | | public class GridSuggestionAdapter extends BaseAdapter { |
| | | |
| | |
| | | ViewHolder viewHolder; |
| | | if (convertView == null) { |
| | | viewHolder = new ViewHolder(); |
| | | if (isHot) { |
| | | convertView = LayoutInflater.from(parent.getContext()).inflate( |
| | | R.layout.suggestion_grid_item, parent, false); |
| | | } else { |
| | | convertView = LayoutInflater.from(parent.getContext()).inflate( |
| | | R.layout.msuggestion_grid_item, parent, false); |
| | | } |
| | | convertView = LayoutInflater.from(parent.getContext()).inflate( |
| | | R.layout.suggestion_grid_item, parent, false); |
| | | viewHolder.tv_suggestion = (TextView) convertView |
| | | .findViewById(R.id.tv_suggestion); |
| | | convertView.setTag(viewHolder); |
| | |
| | | } |
| | | String suggestion = mSuggestions.get(position); |
| | | viewHolder.tv_suggestion.setText(suggestion); |
| | | if (isHot) { |
| | | if (position % 2 == 0) { |
| | | convertView.setBackgroundResource(R.drawable.ic_hot_search1); |
| | | } else { |
| | | convertView.setBackgroundResource(R.drawable.ic_hot_search3); |
| | | |
| | | } |
| | | } |
| | | return convertView; |
| | | } |
| | | |