コード例 #1
0
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    itemPosition = position;
    if (convertView == null) {
      convertView = myInflater.inflate(R.layout.main, null);

      holder = new ViewHolder();
      holder.text = (TextView) convertView.findViewById(R.id.list_text);
      holder.description = (TextView) convertView.findViewById(R.id.description_text);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.text.setPadding(20, 8, 0, 0);
    holder.description.setPadding(20, 40, 0, 0);

    holder.text.setText(mixListView.getDataSourceMenu().get(position));
    holder.description.setText(mixListView.getDataSourceDescription().get(position));

    int colorPos = position % bgcolors.length;
    convertView.setBackgroundColor(bgcolors[colorPos]);
    holder.text.setTextColor(textcolors[colorPos]);
    holder.description.setTextColor(descriptioncolors[colorPos]);

    return convertView;
  }
コード例 #2
0
 @Override
 public int getCount() {
   return mixListView.getDataSourceMenu().size();
 }