• TextView.setTextColor颜色值的理解


    TextView.setTextColor(int value),括号里是int型的值,可以填充的值有三种情况。

    第一种:系统自带的颜色类,TextView.setTextColor(android.graphics.Color.RED)

    第二种:十六进制的颜色值,TextView.setTextColor(0xffff3030);

    说明:0x是代表颜色整数的标记,ff是表示透明度,ff3030表示颜色。必须是8位的颜色表示,6位的ff3030是错误的

    第三种:通过获得资源文件进行设置,TextView.setTextColor(this.getResources().getColor(R.color.red));

    说明:根据不同的情况getColor()可以是R.color.red、R.string.red和R.drawable.red,但必须提前在相应的配置文件里做相应的配置。如:

    <color name="red">#ff3030</color>
    <drawable name="red">#ff3030</drawable>
    <string name="red">#ff3030</string>

  • 相关阅读:
    Console
    在IOS10系统中无法定位问题
    c# js 时间
    ConcurrentDictionary,ConcurrentStack,ConcurrentQueue
    转 控件拖动 未验证
    消息处理模拟点击
    C ProcessAsUser
    SessionChange
    installer
    mysql主从同步配置
  • 原文地址:https://www.cnblogs.com/evolutionoflicorice/p/5728171.html
Copyright © 2020-2023  润新知