java - 如何在 android studio 中将 3 个 int rgb 值转换为一个 int 颜色值?
问题描述
我不知道如何将我的 3 个值(用于 和 的 int 值red
)green
转换blue
为 android 的一种颜色 int 值。
解决方案
颜色 (android.graphics.Color) 是一个默认的 android 类。
int myColor = Color.rgb(red, blue, green)
myView.setBackgroundColor(myColor);
推荐阅读
- c++ - 在 C++ 中比较变量的最有效方法
- python - 访问 python 类实例变量时出错
- gcc - 为什么 -march=native 很少使用?
- maven - 如何将持久存储添加到我的 openshift s2i 构建中,以防止在每次构建时再次下载 deps?
- file - 扑。File existsSync() 总是返回 false
- git - Git暂存区的功能
- javascript - Vue socket io 不工作(不能让它触发连接事件)
- php - 如果用户有 VoIP,则将其发送到 VoIP 呼叫;如果没有,则将其发送到其他地方
- javascript - 方向键移动停止
- python - Python列表理解流控制