public final class ResUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
darker(int color,
float factor)
Darkens a color by a given factor.
|
static android.view.animation.Animation |
getAnim(android.content.Context context,
int resId)
获取动画
|
static android.view.animation.Animation |
getAnim(int resId)
Deprecated.
|
static int |
getColor(android.content.Context context,
int resId)
获取Color值
|
static int |
getColor(int resId)
Deprecated.
|
static android.content.res.ColorStateList |
getColors(android.content.Context context,
int resId)
获取ColorStateList值
|
static android.content.res.ColorStateList |
getColors(int resId)
Deprecated.
|
static android.content.res.ColorStateList |
getColorStateListAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int styleableResId)
获取ColorStateList属性(兼容?attr属性)
|
static float |
getDimens(android.content.Context context,
int resId)
获取dimes值,返回的是精确的值
|
static float |
getDimens(int resId)
Deprecated.
|
static int |
getDimensionPixelOffset(android.content.Context context,
int resId)
获取dimes值,返回的是【去余取整】的值
|
static int |
getDimensionPixelOffset(int resId)
Deprecated.
|
static int |
getDimensionPixelSize(android.content.Context context,
int resId)
获取dimes值,返回的是【4舍5入取整】的值
|
static int |
getDimensionPixelSize(int resId)
Deprecated.
|
static android.graphics.drawable.Drawable |
getDrawable(android.content.Context context,
int resId)
获取资源图片【和主题有关】
|
static android.graphics.drawable.Drawable |
getDrawable(int resId)
Deprecated.
|
static android.graphics.drawable.Drawable[] |
getDrawableArray(android.content.Context context,
int resId)
获取Drawable的数组
|
static android.graphics.drawable.Drawable |
getDrawableAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int styleableResId)
获取Drawable属性(兼容VectorDrawable)
|
static int[] |
getIntArray(android.content.Context context,
int resId)
获取数字的数组
|
static int[] |
getIntArray(int resId)
Deprecated.
|
static android.content.res.Resources |
getResources()
Deprecated.
|
static android.content.res.Resources |
getResources(android.content.Context context)
获取resources对象
|
static java.lang.String |
getString(android.content.Context context,
int resId)
获取字符串
|
static java.lang.String |
getString(int resId)
Deprecated.
|
static java.lang.String[] |
getStringArray(android.content.Context context,
int resId)
获取字符串的数组
|
static java.lang.String[] |
getStringArray(int resId)
Deprecated.
|
static java.util.List<java.lang.String> |
getStringList(android.content.Context context,
int resId)
获取字符串的集合
|
static java.util.List<java.lang.String> |
getStringList(android.content.Context context,
int resId,
int emptyId)
获取字符串的集合
|
static android.graphics.drawable.Drawable |
getVectorDrawable(android.content.Context context,
int resId)
获取svg资源图片
|
static boolean |
isRtl()
Deprecated.
|
static boolean |
isRtl(android.content.Context context)
Check if layout direction is RTL
|
static int |
lighter(int color,
float factor)
Lightens a color by a given factor.
|
@Deprecated public static android.content.res.Resources getResources()
public static android.content.res.Resources getResources(android.content.Context context)
context - 上下文@Deprecated public static java.lang.String getString(int resId)
resId - 资源idpublic static java.lang.String getString(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static android.graphics.drawable.Drawable getDrawable(int resId)
resId - 图片资源idpublic static android.graphics.drawable.Drawable getDrawable(android.content.Context context,
int resId)
resId - 图片资源idpublic static android.graphics.drawable.Drawable getVectorDrawable(android.content.Context context,
int resId)
context - 上下文resId - 图片资源idpublic static android.graphics.drawable.Drawable getDrawableAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int styleableResId)
context - 上下文typedArray - 样式属性数组styleableResId - 样式资源IDpublic static android.content.res.ColorStateList getColorStateListAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int styleableResId)
context - 上下文typedArray - 样式属性数组styleableResId - 样式资源ID@Deprecated public static float getDimens(int resId)
resId - 资源idpublic static float getDimens(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static int getColor(int resId)
resId - 资源idpublic static int getColor(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static android.content.res.ColorStateList getColors(int resId)
resId - 资源idpublic static android.content.res.ColorStateList getColors(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static int getDimensionPixelOffset(int resId)
resId - 资源idpublic static int getDimensionPixelOffset(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static int getDimensionPixelSize(int resId)
resId - 资源idpublic static int getDimensionPixelSize(android.content.Context context,
int resId)
context - 上下文resId - 资源id@Deprecated public static java.lang.String[] getStringArray(int resId)
resId - 资源idpublic static java.lang.String[] getStringArray(android.content.Context context,
int resId)
context - 上下文resId - 资源idpublic static java.util.List<java.lang.String> getStringList(android.content.Context context,
int resId)
context - 上下文resId - 资源idpublic static java.util.List<java.lang.String> getStringList(android.content.Context context,
int resId,
int emptyId)
context - 上下文resId - 资源idemptyId - 空资源idpublic static android.graphics.drawable.Drawable[] getDrawableArray(android.content.Context context,
int resId)
context - contextresId - 资源id@Deprecated public static int[] getIntArray(int resId)
resId - 数组资源idpublic static int[] getIntArray(android.content.Context context,
int resId)
context - 上下文resId - 数组资源id@Deprecated public static android.view.animation.Animation getAnim(int resId)
resId - 动画资源idpublic static android.view.animation.Animation getAnim(android.content.Context context,
int resId)
context - 上下文resId - 动画资源id@Deprecated public static boolean isRtl()
true if the layout direction is right-to-leftpublic static boolean isRtl(android.content.Context context)
context - contexttrue if the layout direction is right-to-leftpublic static int darker(int color,
float factor)
color - the color to darkenfactor - The factor to darken the color.public static int lighter(int color,
float factor)
color - The color to lightenfactor - The factor to lighten the color. 0 will make the color unchanged. 1 will make the
color white.