關於AndroidStudio assets目錄的一些坑

1.新建assets目錄


2.在Activity中加載assets目錄中的圖片資源到bitmap

InputStream inputStream= null;
try {
    inputStream = getAssets().open("timg.jpg");
} catch (IOException e) {
    e.printStackTrace();
}
bitmap= BitmapFactory.decodeStream(inputStream);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章