通过包名读取资源文件

public staticint getElementID(String name,String resType){
Resources mainPackageRes = Context.getResources();
int id = 0;
//从主包 中找资源
if("id".equals(resType)||"layout".equals(resType)||"string".equals(resType)||"style".equals(resType)){
id = mainPackageRes.getIdentifier(name, resType, SkinManagerObservable.getInstance().getmContext().getPackageName());
}else /*("drawable".equals(resType) || "color".equals(resType) || "string".equals(resType))*/{
id = mainPackageRes.getIdentifier(name, resType, Context.getPackageName());
}
return id;
}


【通过包名读取资源文件】

    推荐阅读