如何在Android上使用XML指定RGB格式颜色

前端之家收集整理的这篇文章主要介绍了如何在Android上使用XML指定RGB格式颜色前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
请举例说明在 Android上使用XML指定RGB格式的颜色.语法是#rrggbb.

解决方法

您可以在XML中指定RGB格式的颜色,如下所示:
  1. <TextView
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:layout_centerInParent="true"
  5. android:text="Test text"
  6. android:textColor="#332116"
  7. android:textSize="16sp"
  8. android:textStyle="bold" />

一般形式:

  1. android:textColor="#332116" is "#rrggbb"

猜你在找的Android相关文章