繁体   English   中英

Recyclerview textview 的 Android 随机颜色

[英]Android random color for recyclerview textview

       Random rnd = new Random();
           int currentStrokeColor = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));

            movieVH.initial.setBackgroundColor(currentStrokeColor);

我正在使用 textview 和按钮实现 recyclerview 并尝试为 textview 提供随机颜色,但它没有出现

你可以导入

import android.graphics.Color;
import java.util.Random;

然后使用

Random r = new Random();
datePicker.setBackgroundColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255)));

暂无
暂无

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

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