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

标签 android android-layout

<分区>

请举例说明在 Android 上使用 XML 指定 RGB 格式的颜色。语法是#rrggbb

最佳答案

您可以像这样在 XML 中指定 RGB 格式的颜色:

<TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="Test text"
            android:textColor="#332116"
            android:textSize="16sp"
            android:textStyle="bold" />

一般形式:

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

关于android - 如何在 Android 上使用 XML 指定 RGB 格式的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13005023/

相关文章:

android - 如何将 NavigationView 中的 Tint 设置为某些图标

java - 如何将我的 android 应用程序从 2.2 无缝降级到 1.5 sdk

android - 在 Android 上解码和渲染视频

android - 更改微调器的文本大小

android - 固定屏幕方向

java - Android:(...)Fragment 类和 (...)ViewModel 类

android - 什么是更好的 android.R 或自定义 R?

android - 每个系列的背景 GraphView

android - 想在 android 中为 21 英寸屏幕提供布局

android - 状态栏颜色不会随着相对布局作为根元素而改变