publicclassResourcesUtil {
/**
* 根据Android系统版本,调用版本API中的获取颜色方法
* According to the Android version, calls the method for color of version API
*
* @param activity activity
* @param resId resource id
* @return color
*/publicstaticintgetColor(Activity activity, int resId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return activity.getResources().getColor(resId, activity.getTheme());
} else {
return activity.getResources().getColor(resId);
}
}
/**
* 根据Android系统版本,调用版本API中的获取Drawable方法
* According to the Android version, calls the method for drawable of version API
*
* @param activity activity
* @param resId resource id
* @return color
*/publicstatic Drawable