简体   繁体   English

Collectionview单元格上的不同背景颜色

[英]Collectionview different background colors on cells

From what I see from the image below, correct me if I am wrong, this is a collectionView. 从下面的图片中可以看到,如果我错了,请纠正我,这是一个collectionView。 My question is, how do I set the background colors to the cells to make them look like this? 我的问题是,如何设置单元格的背景色以使其看起来像这样?

I thought that it might be something with an RNG (random number generator) that only generates numbers between 1.0 to 1.99. 我以为RNG(随机数生成器)可能只生成1.0到1.99之间的数字。 Then I multiply the brightest color with the RNG number per cell. 然后,我将最亮的颜色乘以每个单元格的RNG编号。 What am I missing or doing wrong? 我想念什么或做错什么?

I think you're over-engineering it. 我认为您过度设计了它。 There's only three different colors in that collection view. 该集合视图中只有三种不同的颜色。

Hex Values: 十六进制值:

  • 544A3F 544A3F
  • 433C35 433C35
  • 4F473C 4F473C

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM