【android】解码.9图片及xml
生活随笔
收集整理的這篇文章主要介紹了
【android】解码.9图片及xml
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原文地址:http://blog.csdn.net/cc_want/article/details/51381099
1.前言
在公司項目開發中,往往遇到需要一些圖片資源來對android界面進行美化,然而有些時候,小公司沒有美工怎么辦?so easy.下載現成apk,解壓res資源,然后發現,圖片被編譯了?沒關系,接下來我們來編寫程序解密.9圖片
? ? 解密后 ?
2.實現
首先從下面附件中下載apktool.jar包,對于apktool我們就不用多說了,接下來在eclipse新建java工程,導入apktool.jar,創建java類,編寫方法
public void decode9path(File inFile,File outfile){try {InputStream in=new FileInputStream(inFile);OutputStream out=new FileOutputStream(outfile);Res9patchStreamDecoder de=new Res9patchStreamDecoder();de.decode(in, out);} catch (Exception e) {e.printStackTrace();} }對的,這就是解密.9圖片的方法,具體實現請看brut.androlib.res.decoder.Res9patchStreamDecoder這里就不多說了
接下來是解密raw資源的方法
public void decodeRaw(File inFile,File outfile){try {InputStream in=new FileInputStream(inFile);OutputStream out=new FileOutputStream(outfile);ResRawStreamDecoder rrsd=new ResRawStreamDecoder();rrsd.decode(in, out);} catch (Exception e) {e.printStackTrace();} }3.附件
http://download.csdn.net/detail/cc_want/9517501
總結
以上是生活随笔為你收集整理的【android】解码.9图片及xml的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言如何编辑数学公式,怎样用C语言编写
- 下一篇: 软考易错知识点(自用)