最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android 加载assets中的资源文件实例代码
时间:2017-03-06 编辑:简简单单 来源:一聚教程网
Android 加载assets资源
在android中,如何加载assets目录下的文件夹呢?方法很简单,使用 AssetManager, 即
AssetManager assetManager = getAssets();
例子如下:
代码如下 | 复制代码 |
AssetManager assetManager = getAssets();
try{ String[] files = assetManager.list("Files");
for(inti=0; i { 。。。。。。。 } |
读assets下的图片
代码如下 | 复制代码 |
try{
InputStream ims = assetManager.open("android_logo_small.jpg");
Drawable d = Drawable.createFromStream(ims,null);
// set the drawable to imageview imgAssets.setImageDrawable(d); |
相关文章
- sora软件价格介绍 02-22
- sora官网入口地址一览 02-22
- Sora生成的视频使用教程 02-22
- 《梦幻西游》元宵灯谜线索答案大全2024 02-22
- 《原神》有朋自远方来第一天通关攻略 02-22
- 《苏醒之路》四个结局达成攻略 02-22