-
自定義字符串標(biāo)簽
在values下面創(chuàng)建文件,values/speed_strings.xml<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="txt_1" type="speed_string">http://speed_string.com</item>
</resources>
代碼中使用Log.d("", getResources().getString(R.urls.myUrl)); -
讀取assets文件下圖片
private Bitmap getImageFromAssetsFile(String fileName) { Bitmap image = null; AssetManager am = getResources().getAssets(); try { InputStream is = am.open(fileName); image = BitmapFactory.decodeStream(is); is.close(); } catch (Exception e) { e.printStackTrace(); } return image; } //圖片過大時(shí)可能會(huì)內(nèi)存溢出,使用BitmapFactory.Options BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; //讀取圖片的輪廓 Bitmap bmp = BitmapFactory.decodeFile(path, options);/* 這里返回的bmp是null */ options.inSampleSize = options.outWidth / 200; //圖片長(zhǎng)寬方向縮小倍數(shù) Bitmap bmp = BitmapFactory.decodeFile(path, options); options.inDither=false; //不進(jìn)行圖片抖動(dòng)處理 options.inPreferredConfig=null; //設(shè)置讓解碼器以最佳方式解碼 //下面兩個(gè)字段需要組合使用 options.inPurgeable = true; options.inInputShareable = true;
游戲SDK開發(fā)_總結(jié)
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 2021期待與你一起共事,點(diǎn)擊查看崗位[http://www.itdecent.cn/p/6f4d67fa406...
- View 自定義View中在onDraw()方法中可以設(shè)置padding嗎?答案是不能,設(shè)置padding后,Vi...
- 一直以來Bitmap都是開發(fā)中很棘手的問題,這個(gè)問題就是傳說中的OOM(java.lang.OutofMemory...
- ¥開啟¥ 【iAPP實(shí)現(xiàn)進(jìn)入界面執(zhí)行逐一顯】 〖2017-08-25 15:22:14〗 《//首先開一個(gè)線程,因...