public class ConvertUtils extends Object
| 构造器和说明 |
|---|
ConvertUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T[] |
toArray(List<T> list) |
static String |
toBinaryString(byte... bytes)
To binary string string.
|
static String |
toBinaryString(int num)
To binary string string.
|
static android.graphics.Bitmap |
toBitmap(byte[] bytes) |
static android.graphics.Bitmap |
toBitmap(byte[] bytes,
int width,
int height) |
static android.graphics.Bitmap |
toBitmap(android.graphics.drawable.Drawable drawable)
将Drawable转换为Bitmap
参考:http://kylines.iteye.com/blog/1660184
|
static android.graphics.Bitmap |
toBitmap(android.view.View view)
把view转化为bitmap(截图)
参见:http://www.cnblogs.com/lee0oo0/p/3355468.html
|
static byte[] |
toByteArray(android.graphics.Bitmap bitmap) |
static byte[] |
toByteArray(android.graphics.drawable.Drawable drawable) |
static byte[] |
toByteArray(InputStream is) |
static byte[] |
toByteArray(int i)
int占4字节
|
static byte[] |
toByteArray(String hexData,
boolean isHex) |
static android.content.res.ColorStateList |
toColorStateList(int normalColor,
int pressedColor) |
static android.content.res.ColorStateList |
toColorStateList(int normalColor,
int pressedColor,
int focusedColor,
int unableColor)
对TextView、Button等设置不同状态时其文字颜色。
|
static String |
toColorString(int color)
转换为6位十六进制颜色代码,不含“#”
|
static String |
toColorString(int color,
boolean includeAlpha)
转换为6位十六进制颜色代码,不含“#”
|
static int |
toDarkenColor(int color) |
static int |
toDarkenColor(int color,
float value) |
static int |
toDp(android.content.Context context,
float pxValue)
px转换为dp
|
static android.graphics.drawable.Drawable |
toDrawable(android.graphics.Bitmap bitmap) |
static android.graphics.drawable.Drawable |
toDrawable(byte[] bytes) |
static String |
toFileSizeString(long fileSize) |
static float |
toFloat(Object obj) |
static String |
toGbk(String str) |
static String |
toHexString(byte... bytes)
To hex string string.
|
static String |
toHexString(int num)
To hex string string.
|
static String |
toHexString(String str) |
static int |
toInt(byte[] bytes) |
static int |
toInt(Object obj) |
static <T> List<T> |
toList(T[] array) |
static long |
toLong(Object obj) |
static String |
toPath(android.content.Context context,
android.net.Uri uri)
从第三方文件选择器获取路径。
|
static int |
toPx(android.content.Context context,
float dpValue)
dp转换为px
|
static int |
toShort(byte first,
byte second) |
static String |
toSlashString(String str) |
static int |
toSp(android.content.Context context,
float pxValue)
px转换为sp
|
static String |
toString(InputStream is) |
static String |
toString(InputStream is,
String charset) |
static String |
toString(Object[] objects) |
static String |
toString(Object[] objects,
String tag) |
public static final long GB
public static final long MB
public static final long KB
public static int toInt(Object obj)
public static int toInt(byte[] bytes)
public static int toShort(byte first,
byte second)
public static long toLong(Object obj)
public static float toFloat(Object obj)
public static byte[] toByteArray(int i)
i - thepublic static byte[] toByteArray(String hexData, boolean isHex)
public static String toHexString(byte... bytes)
bytes - the bytespublic static String toHexString(int num)
num - the numpublic static String toBinaryString(byte... bytes)
bytes - the bytespublic static String toBinaryString(int num)
num - the numpublic static <T> T[] toArray(List<T> list)
public static <T> List<T> toList(T[] array)
public static byte[] toByteArray(InputStream is)
public static byte[] toByteArray(android.graphics.Bitmap bitmap)
public static android.graphics.Bitmap toBitmap(byte[] bytes,
int width,
int height)
public static android.graphics.Bitmap toBitmap(byte[] bytes)
public static android.graphics.Bitmap toBitmap(android.graphics.drawable.Drawable drawable)
public static String toPath(android.content.Context context, android.net.Uri uri)
public static android.graphics.Bitmap toBitmap(android.view.View view)
public static android.graphics.drawable.Drawable toDrawable(android.graphics.Bitmap bitmap)
public static byte[] toByteArray(android.graphics.drawable.Drawable drawable)
public static android.graphics.drawable.Drawable toDrawable(byte[] bytes)
public static int toPx(android.content.Context context,
float dpValue)
public static int toDp(android.content.Context context,
float pxValue)
public static int toSp(android.content.Context context,
float pxValue)
public static String toFileSizeString(long fileSize)
public static String toString(InputStream is, String charset)
public static String toString(InputStream is)
public static int toDarkenColor(int color)
public static int toDarkenColor(int color,
float value)
public static String toColorString(int color)
public static String toColorString(int color, boolean includeAlpha)
public static android.content.res.ColorStateList toColorStateList(int normalColor,
int pressedColor,
int focusedColor,
int unableColor)
public static android.content.res.ColorStateList toColorStateList(int normalColor,
int pressedColor)