【问题标题】:Get html color code for color saved in `Color.xml` in Android [duplicate]获取保存在Android中`Color.xml`中颜色的html颜色代码[重复]
【发布时间】:2016-09-20 11:55:18
【问题描述】:

android.graphics.Color 中的所有方法似乎都返回整数而不是字符串。有没有办法返回代表Android中colors.xml中保存的颜色的Html代码的字符串?

【问题讨论】:

  • 您可以通过调用 Integer.toHexString 将 int 值转换为十六进制字符串
  • 整数到十六进制的转换?
  • @DanielNugent 它具有颜色的 int 表示。他想知道十六进制(表示保存在colors.xml中的颜色的Html代码的字符串
  • @Blackbelt 看起来你是对的,看起来不错!

标签: android android-layout


【解决方案1】:

你可以试试:

String colour = Integer.parseInt(int);

【讨论】:

    猜你喜欢
    • 2013-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-10
    • 2013-10-08
    • 2013-04-25
    相关资源
    最近更新 更多