asysbang

 找回密码
 立即注册
查看: 2118|回复: 0
打印 上一主题 下一主题

动态加载资源

[复制链接]

513

主题

2

好友

6404

积分

管理员

Rank: 80Rank: 80Rank: 80Rank: 80Rank: 80

最佳新人 活跃会员 热心会员 推广达人 宣传达人 灌水之王 突出贡献 优秀版主 荣誉管理 论坛元老

跳转到指定楼层
楼主
发表于 2019-11-22 10:06:30 |只看该作者 |倒序浏览
AssetManager assetManager = AssetManager.class.newInstance();
AssetManager.class.getDeclaredMethod("addAssetPath", String.class).invoke( assetManager, apkPath);

new Resources(assetManager, context.getResources().getDisplayMetrics(), context.getResources().getConfiguration())

Resources resources=AssertsDexLoader.getResource(getApplicationContext(),dexPath);

Drawable drawable=resources.getDrawable(resources.getIdentifier("bd_logo1","drawable","com.xingen.plugin"));


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

Archiver|手机版|aSys-帮 ( 京ICP备13033689号 )

GMT+8, 2024-10-6 18:29 , Processed in 0.053496 second(s), 20 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部