Android 加載assets資源
在android中,如何加載assets目錄下的文件夾呢?方法很簡單,使用 AssetManager, 即
AssetManager assetManager = getAssets();
例子如下:
AssetManager assetManager = getAssets(); try { String[] files = assetManager.list("Files"); for(int i=0; i<FILES.LENGTH; { 。。。。。。。 } 讀assets下的圖片
try { InputStream ims = assetManager.open("android_logo_small.jpg"); Drawable d = Drawable.createFromStream(ims, null); // set the drawable to imageview imgAssets.setImageDrawable(d); 感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答
圖片精選