要在Java代码中,直接访问该资源,只需使用getResources.getString或getString方法来访问给定的资源ID值:
Resources res = getResources();
float fontSize = res.getDimension(R.dimen.font_size);
int color = ContextCompat.getColor(context, R.color.yellow);
String submitText = getResources().getString(R.string.submit_label)