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(int resId)
获取动画
|
static int |
getColor(int resId)
获取Color值
|
static android.content.res.ColorStateList |
getColors(int resId)
获取ColorStateList值
|
static float |
getDimens(int resId)
获取dimes值,返回的是精确的值
|
static int |
getDimensionPixelOffset(int resId)
获取dimes值,返回的是【去余取整】的值
|
static int |
getDimensionPixelSize(int resId)
获取dimes值,返回的是【4舍5入】的值
|
static android.graphics.drawable.Drawable |
getDrawable(android.content.Context context,
int resId)
获取资源图片【和主体有关】
|
static android.graphics.drawable.Drawable |
getDrawable(int resId)
获取资源图片
|
static android.graphics.drawable.Drawable |
getDrawableAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int index)
获取Drawable属性(兼容VectorDrawable)
|
static int[] |
getIntArray(int resId)
获取数字的数组
|
static android.content.res.Resources |
getResources()
获取resources对象
|
static java.lang.String |
getString(int resId)
获取字符串
|
static java.lang.String[] |
getStringArray(int resId)
获取字符串的数组
|
static android.graphics.drawable.Drawable |
getVectorDrawable(android.content.Context context,
int resId)
获取svg资源图片
|
static boolean |
isRtl()
Check if layout direction is RTL
|
static int |
lighter(int color,
float factor)
Lightens a color by a given factor.
|
public static android.content.res.Resources getResources()
public static java.lang.String getString(int resId)
resId - public static android.graphics.drawable.Drawable getDrawable(int resId)
resId - public static android.graphics.drawable.Drawable getDrawable(android.content.Context context,
int resId)
resId - public static android.graphics.drawable.Drawable getVectorDrawable(android.content.Context context,
int resId)
context - resId - public static android.graphics.drawable.Drawable getDrawableAttrRes(android.content.Context context,
android.content.res.TypedArray typedArray,
int index)
context - typedArray - index - public static float getDimens(int resId)
resId - public static int getColor(int resId)
resId - public static android.content.res.ColorStateList getColors(int resId)
resId - public static int getDimensionPixelOffset(int resId)
resId - public static int getDimensionPixelSize(int resId)
resId - public static java.lang.String[] getStringArray(int resId)
resId - public static int[] getIntArray(int resId)
resId - public static android.view.animation.Animation getAnim(int resId)
resId - public static boolean isRtl()
true 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.