【问题标题】:How do I give "#ffff" string color to setBackgroundColor() as parameter? [duplicate]如何将“#ffff”字符串颜色作为参数提供给 setBackgroundColor()? [复制]
【发布时间】:2020-02-27 13:02:29
【问题描述】:

我想为相对布局赋予颜色 setBackgroundColor() 并且颜色值类似于 "#ffffff"setBackgroundColor() dosent 接受字符串值

【问题讨论】:

  • 顺便说一句...g 不是有效的十六进制数字,所以什么都不应该接受"#Fgfff"
  • 哎呀这是错字,#ffffff

标签: android


【解决方案1】:

您可以使用以下代码:-

Relativelayout.setBackgroundColor(Color.parseColor("#ffffff"))

【讨论】:

  • RelativeLayout 没有setCardBackgroundColor 方法。
猜你喜欢
  • 2013-03-15
  • 1970-01-01
  • 1970-01-01
  • 2012-07-15
  • 1970-01-01
  • 2014-03-20
  • 2014-06-28
  • 1970-01-01
  • 2011-06-28
相关资源
最近更新 更多