android – 如何通过XML将textview的背景颜色设置为全息绿光?

android – 如何通过XML将textview的背景颜色设置为全息绿光?,第1张

概述我有一个textview,我会把它的背景颜色设置为全光绿色,如 here.所述 但是,我不知道如何通过XML来做到这一点.可能吗?我目前有: <TextView android:text="2" android:textSize="200sp" android:layout_width="fill_parent" android:la 我有一个textvIEw,我会把它的背景颜色设置为全光绿色,如 here.所述

但是,我不知道如何通过XML来做到这一点.可能吗?我目前有:

<TextVIEw        androID:text="2"        androID:textSize="200sp"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:ID="@+ID/textVIEw2"        androID:background="#00FF00"        androID:gravity="center"        androID:textcolor="#EEEEEE"        androID:layout_alignParentRight="true" />

但是,我无法改变androID:背景以某种方式引用全息绿光.

有没有人有什么建议?我试过“@androID:color /”,但没有骰子.

解决方法 通过Java:
TextVIEw test = (TextVIEw) vIEw.findVIEwByID(R.ID.textVIEw2);test.setBackgroundResource(context.getResources().getcolor(androID.R.color.holo_green_light));

通过XML:

<TextVIEw        androID:text="2"        androID:textSize="200sp"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent"        androID:ID="@+ID/textVIEw2"        androID:         androID:background="@androID:color/holo_green_light"        androID:gravity="center"        androID:textcolor="#EEEEEE"        androID:layout_alignParentRight="true" />

This是关于此主题的API页面

总结

以上是内存溢出为你收集整理的android – 如何通过XML将textview的背景颜色设置为全息绿光?全部内容,希望文章能够帮你解决android – 如何通过XML将textview的背景颜色设置为全息绿光?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1133790.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存