小编cam*_*der的帖子

如何以编程方式为所有TextView设置文本颜色?

TextView动态创建8 秒并在我的布局中添加它们.我想设置他们的文字颜色.所以我在color.xml中声明了颜色代码,我将其设置为:

txt1.setTextColor(getResources().getColor(R.color.off_white));
Run Code Online (Sandbox Code Playgroud)

但我必须多余地为所有人TextView单独做这件事.有没有办法我可以为所有TextView全局设置它.类似于我们在jQuery中可以做的事情,例如:

$('input[type="text"]').css('color','white');
Run Code Online (Sandbox Code Playgroud)

android textview

1
推荐指数
1
解决办法
1291
查看次数

标签 统计

android ×1

textview ×1