如何使用壁画中的资产目录中读取任何软件包的gif图片 [英] How to use Fresco to read any package's gif image in the assets directory
本文介绍了如何使用壁画中的资产目录中读取任何软件包的gif图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何读取本地包资产目录中的GIF图像。但现在我需要在其他资产包阅读其他GIF图像。例如主APP com.aaa.app阅读资产com.bbb.app GIF。我知道用
I know how to read the gif image in local package assets directory. But now I need read other gif image in other package assets. for example the main APP com.aaa.app to read the com.bbb.app gif in assets. I know use
try{
context = this.createPackageContext(
"com.bbb.app",
Context.CONTEXT_IGNORE_SECURITY);
}catch (PackageManager.NameNotFoundException e){
e.printStackTrace();
}
AssetManager am = context.getResources().getAssets();
try
{
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}
读取JPG / PNG,但我想读GIF使用壁画库。任何人都知道该怎么办呢?
to read jpg/png, but I want to read gif use Fresco lib. Anyone know how to do it?
推荐答案
目前,壁画支持以下内容:
At the moment, Fresco supports the following:
Uri uri = Uri.parse("asset:///image.png");
这被翻译成:
AssetManager.openFd("image.png");
这篇关于如何使用壁画中的资产目录中读取任何软件包的gif图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文