[英]How can I change the TextView text color on the appwidget?
As I mentioned in the title, I cannot change the color of the TextView.(Programmatically)正如我在标题中提到的,我无法更改 TextView 的颜色。(以编程方式)
I've tried the following codes but it doesn't work:我已经尝试了以下代码,但它不起作用:
views.setTextColor( R.id.txtPtw2Gunes, context.getResources().getColor( R.color.widgetOrange ) );
views.setTextColor( R.id.txtPtw2Aksam, Color.parseColor( "#e4e4e4" ) );
How can I help you do this?我怎样才能帮助你做到这一点?
EDIT: views.setTextColor( R.id.txtPtw2Gunes, context.getResources().getColor( R.color.widgetOrange ) );
编辑:
views.setTextColor( R.id.txtPtw2Gunes, context.getResources().getColor( R.color.widgetOrange ) );
Actually the code I added works, but it doesn't work on the emulator.实际上我添加的代码有效,但它不适用于模拟器。 I found it working when I tested it on a real phone.
当我在真机上测试它时,我发现它可以工作。
The subject may be locked.主题可能被锁定。
Perhaps you could try something like:也许您可以尝试以下方法:
((TextView)findViewById(R.id.txtPtw2Gunes)).setTextColor(getResources().getColor(R.color.widgetOrange));
or或者
((TextView)views.findViewById(R.id.txtPtw2Gunes)).setTextColor(getResources().getColor(R.color.widgetOrange));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.