在设置Text时提示Should pass resolved color instead of resource id here
我是这样设置文本颜色的
public void addText(CharSequence cs) {
for (int i = 0; i < cs.length(); i++) {
TextView tv = new TextView(activity);
tv.setTextColor(R.color.pantry_blue);
tv.setTextSize(36);
tv.setText(cs.charAt(i) + "");
lLayout.addView(tv);
}
}
出现提示:
Should pass resolved color instead of resource id here: getResources().getColor(R.color.app_separator)
Issue: Looks for calls to setColor where a resource id is passed instead of a resolved color
Id: ResourceAsColor
Methods that take a color in the form of an integer should be passed an RGB triple, not the actual color resource id. You must call getResources().getColor(resource) to resolve the actual color value first.
到底是什么原因呢,还请各位指点