[android]zip压缩中使用的.9.png,用aapt处理的方法。
来源:互联网 发布:python os. exit 0 编辑:程序博客网 时间:2024/05/16 08:09
框架提供了一种Theme切换的方案,具体原理不清楚,表现如下:
提供N个theme文件夹,把对应的图片和颜色放入这些theme文件夹下的zip压缩格式的包中,则切换theme时,使用的资源会根据theme的切换而切换,如:
/custpack/theme/1/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
/custpack/theme/2/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
/custpack/theme/3/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
/custpack/theme/4/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
/custpack/theme/5/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
/custpack/theme/6/com.android.mms/res/drawable-ldpi/list_selected_holo_light.9.png
PS:com.android.mms为一个zip格式的压缩包,进行zip压缩后,把.zip的后缀名去掉即可。当用户在设置的Theme中切换主题时,模块中使用的list_selected_holo_light.9.png图片会变化。
UE提供的.9.png图片,直接放入com.android.mms中,显示总有问题,后来确认是要用aapt工具处理一下,原理目前未知,处理方法如下:
aapt s -i inputfile -o outputfile
PS:inputfile为UE提供的图片,outputfile为可使用的图片
因为UE提供的.9.png图片比较多,这里采用了如下的python来对这些图片进行批处理:
# -*- coding: utf-8 -*- # It is ok at python-3.3.1rc1.msi installer condition. # example: aapt s -i inputfile -o outputfile# D:\AndroidDev\adt-bundle-windows-x86-20130729\sdk\build-tools\android-4.3\aapt.exe s -i E:\98.Temp\ThemeTest\blue_top.9.png -o E:\98.Temp\ThemeTest\blue_top_new.9.pngimport osimport rewalk_names = os.walk(r'E:\98.Temp\ThemeTest')cmd = r'D:\AndroidDev\adt-bundle-windows-x86-20130729\sdk\build-tools\android-4.3\aapt.exe';for (directory, sub_directorys, file_names) in walk_names: for name in file_names: m = re.match(r'(.+)\.9\.png$', name, re.I) if m: src = os.path.join(directory, name) dst = os.path.join(directory, m.group(1)) + '_new.9.png' tmpCmd = cmd + ' s -v -i ' + src + ' -o ' + dst print(tmpCmd) os.system(tmpCmd)
- [android]zip压缩中使用的.9.png,用aapt处理的方法。
- Android - Unparsed aapt error(s)错误的处理方法
- Android - Unparsed aapt error(s)错误的处理方法
- Android - Unparsed aapt error(s)错误的处理方法
- Android - Unparsed aapt error(s)错误的处理方法
- Android - Unparsed aapt error(s)错误的处理方法
- android assets中.9.png的使用
- android assets中.9.png的使用
- android assets中.9.png的使用
- android aapt命令的使用
- java中zip压缩包的中文处理问题
- java中zip压缩包的中文处理问题
- java简单的压缩方法(zip压缩)
- 【干货】一键压缩Android项目中png的大小!
- C#中压缩/解压缩7-zip文件的方法
- Android:9.png图片的处理
- Android中.9.png图片的使用过程和原理
- Android中.9.png图片的使用过程和原理
- 在Android应用程序中Java和JavaScript如何交互?
- 布局文件提示错误“No orientation specified, and the default is horizontal. This is a common so...”
- wifi不能共享解决方法
- maven和ant的区别
- 安装文档
- [android]zip压缩中使用的.9.png,用aapt处理的方法。
- jquery系列教程一
- TCP服务端实现table.html发布
- linux ulimit设置
- 股票交易代码
- 《黑马程序员》 Buffered缓冲区练习之基于子线程的文件复制
- success
- Dapper ORM
- 关于oracle公司设计软件如oracle数据库软件等的思想模式杂记【收集中】