有没有办法Context在静态方法中获取当前实例?
我正在寻找那种方式,因为我讨厌每次更改时保存"Context"实例.
该Resources.getColor(int id)方法已被弃用.
@ColorInt
@Deprecated
public int getColor(@ColorRes int id) throws NotFoundException {
return getColor(id, null);
}
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
android android-resources android-mnc android-6.0-marshmallow
我有一个自定义游标适配器,我试图设置其中一个行视图的文本框的颜色:
txtChange.setTextColor(0xE01B4C);
txtChange.setText("Hey I'm some Text!");
Run Code Online (Sandbox Code Playgroud)
如果我删除了setTextColor呼叫,则文本按预期显示.我错过了什么?