/// <summary> /// 每次显示8个 /// </summary> private void showHotWord() { int start, end; if (times < tagList.Count() && times + 8 <= tagList.Count()) { start = times; end = times + 8; } else if (times < tagList.Count() - 1 && times + 8 > tagList.Count()) { start = times; end = tagList.Count() - 1; } else { start = 0; end = tagList.Count() > 8 ? 8 : tagList.Count(); } times = end; if (end - start > 0) { List <String> batch = tagList.GetRange(start, end - start); List <TagColor> colors = TagColor.getRandomColors(batch.Count()); mTagGroup.setTags(colors, batch.ToArray()); } }
/// <summary> /// 每次显示8个热搜词 /// </summary> private /*synchronized*/ void showHotWord() { int tagSize = 8; String[] tags = new String[tagSize]; for (int j = 0; j < tagSize && j < tagList.Count(); hotIndex++, j++) { tags[j] = tagList[hotIndex % tagList.Count()]; } List <TagColor> colors = TagColor.getRandomColors(tagSize); mTagGroup.setTags(colors, tags); }