获取res/drawable目录下的图片Uri:
/**
* 得到资源文件中图片的Uri
* @param context 上下文对象
* @param id 资源id
* @return Uri
*/
public Uri getUriFromDrawableRes(Context context, int id) {
Resources resources = context.getResources();
String path = ContentResolver.SCHEME_ANDROID_RESOURCE + "://"
+ resources.getResourcePackageName(id) + "/"
+ resources.getResourceTypeName(id) + "/"
+ resources.getResourceEntryName(id);
return Uri.parse(path);
}