android ninepatchmninepatchchunk null 是什么意思

酷勤网 C 程序员的那点事!
当前位置: >
浏览次数:次
这篇文章主要介绍在实际Android应用程序的开发中,容易导致内存泄露的一些情况。开发人员如果在进行代码编写之前就有内存泄露方面的基础知识,那么写出来的代码会强壮许多,写这篇文章也是这个初衷。本文从Android开发中的资源使用情况入手,介绍了如何在Bitmap、数据库查询、9-patch、过渡绘制等方面优化内存的使用。
Android资源优化
1. Bitmap优化
Android中的大部分内存问题归根结底都是Bitmap的问题,如果打开MAT(Memory analyzer tool)来看,实际占用内存大的都是一些Bitmap(以byte数组的形式存储)。所以Bitmap的优化应该是我们着重去解决的。Google在其官方有针对Bitmap的使用专门写了一个专题 :, 对应的中文翻译在 :, 在优化Bitmap资源之前,请先看看这个系列的文档,以确保自己正确地使用了Bitmap。
Bitmap如果没有被释放,那么一般只有两个问题:
用户在使用完这个Bitmap之后,没有主动去释放Bitmap资源。
这个Bitmap资源被引用所以无法被释放 。
1.1 主动释放Bitmap资源
当你确定这个Bitmap资源不会再被使用的时候(当然这个Bitmap不释放可能会让程序下一次启动或者resume快一些,但是其占用的内存资源太大,可能导致程序在后台的时候被杀掉,反而得不偿失),我们建议手动调用recycle()方法,释放其Native内存:
+if(bitmap != null && !bitmap.isRecycled()){
bitmap.recycle();
bitmap = }
我们也可以看一下Bitmap.java中recycle()方法的说明:
+123456789101112131415161718192021222324252627282930
* Free the native object associated with this bitmap, and clear the
* reference to the pixel data. This will not free the pixe
* it simply allows it to be garbage collected if there are no other references.
* The bitmap is marked as &dead&, meaning it will throw an exception if
* getPixels() or setPixels() is called, and will draw nothing. This operation
* cannot be reversed, so it should only be called if you are sure there are no
* further uses for the bitmap. This is an advanced call, and normally need
* not be called, since the normal GC process will free up this memory when
* there are no more references to this bitmap.
public void recycle() {
if (!mRecycled) {
if (nativeRecycle(mNativeBitmap)) {
// return value indicates whether native pixel object was actually recycled.
// false indicates that it is still in use at the native level and these
// objects should not be collected now. They will be collected later when the
// Bitmap itself is collected.
mNinePatchChunk =
mRecycled =
}......//如果使用过程中抛出异常的判断if (bitmap.isRecycled()) {
throw new RuntimeException(&Canvas: trying to use a recycled bitmap & + bitmap);}
调用bitmap.recycle之后,这个Bitmap如果没有被引用到,那么就会被垃圾回收器回收。如果不主动调用这个方法,垃圾回收器也会进行回收工作,只不过垃圾回收器的不确定性太大,依赖其自动回收不靠谱(比如垃圾回收器一次性要回收好多Bitmap,那么需要的时间就会很多,导致回收的时候会卡顿)。所以我们需要主动调用recycle。
1.2 主动释放ImageView的图片资源
由于我们在实际开发中,很多情况是在xml布局文件中设置ImageView的src或者在代码中调用ImageView.setImageResource/setImageURI/setImageDrawable等方法设置图像,下面代码可以回收这个ImageView所对应的资源:
+123456789101112131415161718192021
+private static void recycleImageViewBitMap(ImageView imageView) {
if (imageView != null) {
BitmapDrawable bd = (BitmapDrawable) imageView.getDrawable();
rceycleBitmapDrawable(bd);
}}private static void rceycleBitmapDrawable(BitmapDrawable bitmapDrawable) {
if (bitmapDrawable != null) {
Bitmap bitmap = bitmapDrawable.getBitmap();
rceycleBitmap(bitmap);
bitmapDrawable =}private static void rceycleBitmap(Bitmap bitmap) {
if (bitmap != null && !bitmap.isRecycled()) {
bitmap.recycle();
1.3 主动释放ImageView的背景资源
如果你的ImageView是有Background,那么下面的代码可以释放他:
+123456789101112131415161718192021
+public static void recycleBackgroundBitMap(ImageView view) {
if (view != null) {
BitmapDrawable bd = (BitmapDrawable) view.getBackground();
rceycleBitmapDrawable(bd);
}}public static void recycleImageViewBitMap(ImageView imageView) {
if (imageView != null) {
BitmapDrawable bd = (BitmapDrawable) imageView.getDrawable();
rceycleBitmapDrawable(bd);
}}private static void rceycleBitmapDrawable(BitmapDrawable bitmapDrawable) {
if (bitmapDrawable != null) {
Bitmap bitmap = bitmapDrawable.getBitmap();
rceycleBitmap(bitmap);
bitmapDrawable =}
1.4 尽量少用Png图,多用NinePatch的图
现在手机的分辨率越来越高,图片资源在被加载后所占用的内存也越来越大,所以要尽量避免使用大的PNG图,在产品设计的时候就要尽量避免用一张大图来进行展示,尽量多用NinePatch资源。
Android中的NinePatch指的是一种拉伸后不会变形的特殊png图,NinePatch的拉伸区域可以自己定义。这种图的优点是体积小,拉伸不变形,可以适配多机型。Android SDK中有自带NinePatch资源制作工具,Android-Studio中在普通png图片点击右键可以将其转换为NinePatch资源,使用起来非常方便。
1.5 使用大图之前,尽量先对其进行压缩
图片有不同的形状与大小。在大多数情况下它们的实际大小都比需要呈现出来的要大很多。例如,系统的Gallery程序会显示那些你使用设备camera拍摄的图片,但是那些图片的分辨率通常都比你的设备屏幕分辨率要高很多。
考虑到程序是在有限的内存下工作,理想情况是你只需要在内存中加载一个低分辨率的版本即可。这个低分辨率的版本应该是与你的UI大小所匹配的,这样才便于显示。一个高分辨率的图片不会提供任何可见的好处,却会占用宝贵的(precious)的内存资源,并且会在快速滑动图片时导致(incurs)附加的效率问题。
Google官网的Training中,有一篇文章专门介绍如何有效地加载大图,里面提到了两个比较重要的技术:
在图片加载前获取其宽高和类型
加载一个按比例缩小的版本到内存中
原文地址:,中文翻译地址:,强烈建议每一位Android开发者都去看一下,并在自己的实际项目中使用到。
更多关于Bitmap的使用和优化,可以参考Android官方Training专题的
2 查询数据库没有关闭游标
程序中经常会进行查询数据库的操作,但是经常会有使用完毕Cursor后没有关闭的情况。如果我们的查询结果集比较小,对内存的消耗不容易被发现,只有在常时间大量操作的情况下才会复现内存问题,这样就会给以后的测试和问题排查带来困难和风险。
示例代码:
+Cursor cursor = getContentResolver().query(uri ...); if (cursor.moveToNext()) {
修正示例代码:
+123456789101112131415
+Cursor cursor =try {
cursor = getContentResolver().query(uri ...); if (cursor != null && cursor.moveToNext()) { ... ...
} } finally {
if (cursor != null) { try {
cursor.close(); } catch (Exception e) {
//ignore this
3 构造Adapter时,没有使用缓存的convertView
以构造ListView的BaseAdapter为例,在BaseAdapter中提供了方法:
+public View getView(int position, View convertView, ViewGroup parent)
来向ListView提供每一个item所需要的view对象。初始时ListView会从BaseAdapter中根据当前的屏幕布局实例化一定数量的view对象,同时ListView会将这些view对象缓存起来。当向上滚动ListView时,原先位于最上面的list item的view对象会被回收,然后被用来构造新出现的最下面的list item。这个构造过程就是由getView()方法完成的,getView()的第二个形参 View convertView就是被缓存起来的list item的view对象(初始化时缓存中没有view对象则convertView是null)。
由此可以看出,如果我们不去使用convertView,而是每次都在getView()中重新实例化一个View对象的话,即浪费资源也浪费时间,也会使得内存占用越来越大。ListView回收list item的view对象的过程可以查看:android.widget.AbsListView.java && void addScrapView(View scrap) 方法。
示例代码:
+public View getView(int position, View convertView, ViewGroup parent) { View view = new Xxx(...); ... ...}
示例修正代码:
+123456789101112
+public View getView(int position, View convertView, ViewGroup parent) { View view = if (convertView != null) { view = convertV populate(view, getItem(position)); ... } else { view = new Xxx(...); ... }}
关于ListView的使用和优化,可以参考这两篇文章:
4 释放对象的引用
前面有说过,一个对象的内存没有被释放是因为他被其他的对象所引用,系统不回去释放这些有GC Root的对象。
假设有如下操作
+123456789101112131415
+public class DemoActivity extends Activity { ... ... private Handler mHandler = ... private O public void operation() {
obj = initObj();
mHandler.post(new Runnable() {
public void run() {
useObj(obj);
我们有一个成员变量 obj,在operation()中我们希望能够将处理obj实例的操作post到某个线程的MessageQueue中。在以上的代码中,即便是mHandler所在的线程使用完了obj所引用的对象,但这个对象仍然不会被垃圾回收掉,因为DemoActivity.obj还保有这个对象的引用。所以如果在DemoActivity中不再使用这个对象了,可以在[Mark]的位置释放对象的引用,而代码可以修改为:
+1234567891011
+public void operation() { obj = initObj(); ... final Object o = obj = mHandler.post(new Runnable() {
public void run() {
useObj(o);
假设我们希望在锁屏界面(LockScreen)中,监听系统中的电话服务以获取一些信息(如信号强度等),则可以在LockScreen中定义一个PhoneStateListener的对象,同时将它注册到TelephonyManager服务中。对于LockScreen对象,当需要显示锁屏界面的时候就会创建一个LockScreen对象,而当锁屏界面消失的时候LockScreen对象就会被释放掉。
但是如果在释放LockScreen对象的时候忘记取消我们之前注册的PhoneStateListener对象,则会导致LockScreen无法被垃圾回收。如果不断的使锁屏界面显示和消失,则最终会由于大量的LockScreen对象没有办法被回收而引起OutOfMemory,使得system_ui进程挂掉。
总之当一个生命周期较短的对象A,被一个生命周期较长的对象B保有其引用的情况下,在A的生命周期结束时,要在B中清除掉对A的引用。
使用MAT可以很方便地查看对象之间的引用,
5 在Activity的生命周期中释放资源
Android应用程序中最典型的需要注意释放资源的情况是在Activity的生命周期中,在onPause()、onStop()、onDestroy()方法中需要适当的释放资源的情况。由于此情况很基础,在此不详细说明,具体可以查看官方文档对Activity生命周期的介绍,以明确何时应该释放哪些资源。
6 消除过渡绘制
过渡绘制指的是在屏幕一个像素上绘制多次(超过一次),比如一个TextView后有背景,那么显示文本的像素至少绘了两次,一次是背景,一次是文本。GPU过度绘制或多或少对性能有些影响,设备的内存带宽是有限的,当过度绘制导致应用需要更多的带宽(超过了可用带宽)的时候性能就会降低。带宽的限制每个设备都可能是不一样的。
过渡绘制的原因:
同一层级的View叠加
复杂的层级叠加
减少过渡绘制能去掉一些无用的View,能有效减少GPU的负载,也可以减轻一部分内存压力。关于过渡绘制我专门写了一篇文章来介绍:
7 使用Android系统自带的资源
在Android应用开发过程中,屏幕上控件的布局代码和程序的逻辑代码通常是分开的。界面的布局代码是放在一个独立的xml文件中的,这个文件里面是树型组织的,控制着页面的布局。通常,在这个页面中会用到很多控件,控件会用到很多的资源。Android系统本身有很多的资源,包括各种各样的字符串、图片、动画、样式和布局等等,这些都可以在应用程序中直接使用。这样做的好处很多,既可以减少内存的使用,又可以减少部分工作量,也可以缩减程序安装包的大小。
比如下面的代码就是使用系统的ListView:
+&ListView
android:id=&@android:id/list&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&/&
8 使用内存相关工具检测
在开发中,不可能保证一次就开发出一个内存管理非常棒的应用,所以在开发的每一个阶段,都要有意识地去针对内存进行专门的检查。目前Android提供了许多布局、内存相关的工具,比如Lint、MAT等。学会这些工具的使用是一个Android开发者必不可少的技能。
& 相关主题:android ninepatchdrawable 怎么打包_百度知道
android ninepatchdrawable 怎么打包
1.首先你要把hashmap改成HashMap(String, Drawable)2.然后put进去3.mageView有个方法4.setImageDrawable(Drawable d)5.直接把drawable对象传如即可6.如果只能得到资源,可以调用setImageResource(int resourceId)
其他类似问题
为您推荐:
提问者采纳
android.graphics.drawable类 NinePatchDrawablejava.lang.Object
android.graphics.drawable.Drawable
android.graphics.drawable.NinePatchDrawablepublic class NinePatchDrawableextends DrawableA resizeable bitmap, with stretchable areas that you define. This type of image is defined in a .png file with a special format, described in Resources.嵌套类摘要类 android.graphics.drawable.Drawable 继承嵌套类/接口Drawable.Callback, Drawable.ConstantState
构造摘要NinePatchDrawable(Bitmap bitmap, byte[] chunk, Rect padding, String srcName)
NinePatchDrawable(NinePatch patch) 摘要 void
draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
getChangingConfigurations()
Return a mask of the configuration parameters for which this drawable mau change, requiring that it be re-created.
Drawable.ConstantState
getConstantState()
getIntrinsicHeight()
Retrieves the height of the source .png file (before resizing).
getIntrinsicWidth()
Retrieves the width of the source .png file (before resizing).
getMinimumHeight()
Returns the minimum height suggested by this Drawable.
getMinimumWidth()
Returns the minimum width suggested by this Drawable.
getOpacity()
Returns a graphics.PixelFormat value of OPAQUE or TRANSLUCENT.
getPadding(Rect padding)
Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.
getPaint()
getTransparentRegion()
Returns a Region representing the part of the Drawable that is completely transparent.
inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
Make this drawable mutable.
setAlpha(int alpha)
Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.
setColorFilter(ColorFilter cf)
Specify an optional colorFilter for the drawable.
setDither(boolean dither)
Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component.
类 android.graphics.drawable.Drawable 继承clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getBounds, getCurrent, getLevel, getState, invalidateSelf, isStateful, isVisible, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setFilterBitmap, setLevel, setState, setVisible, unscheduleSelf
类 java.lang.Object 继承equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
构造详细信息NinePatchDrawablepublic NinePatchDrawable(Bitmap bitmap,
byte[] chunk,
Rect padding,
String srcName)NinePatchDrawablepublic NinePatchDrawable(NinePatch patch)详细信息drawpublic void draw(Canvas canvas)类 Drawable 复制描述Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).指定者:类 Drawable
draw参数:canvas - The canvas to draw intogetChangingConfigurationspublic int getChangingConfigurations()类 Drawable 复制描述Return a mask of the configuration parameters for which this drawable mau change, requiring that it be re-created. The default implementation returns whatever was provided through Drawable.setChangingConfigurations(int) or 0 by default. Subclasses may extend this to or in the changing configurations of any other drawables they hold.覆盖:类 Drawable
getChangingConfigurations返:Returns a mask of the changing configuration parameters, as defined by Configuration.另请参见:ConfigurationgetPaddingpublic boolean getPadding(Rect padding)类 Drawable 复制描述Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds. Positive values move toward the center of the Drawable (set Rect.inset). Returns true if this drawable actually has a padding, else false. When false is returned, the padding is always set to 0.覆盖:类 Drawable
getPaddingsetAlphapublic void setAlpha(int alpha)类 Drawable 复制描述Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.指定者:类 Drawable
setAlphasetColorFilterpublic void setColorFilter(ColorFilter cf)类 Drawable 复制描述Specify an optional colorFilter for the drawable. Pass null to remove any filters.指定者:
来自团队:
其他2条回答
以下是打包脚本:
apply plugin: 'com.android.application'
def versionNameString=&1.0&
def versionCodeInt=1
def appName=&打包测试&
//你的应用的名称
releaseApk='app/build/outputs/apk/app-release.apk'
def packageChannel(String versionName,String appName,String releaseApk){
def stdout = new ByteArrayOutputStream()
//执行Python脚本
commandLine 'python',rootProject.getRootDir().getAbsolutePath()+&/app/mulit_channel.py&,versionName,appName,releaseApk
standardOutput = stdout
return stdout.toString().trim()
catch (ignored) {
抱歉,可能时间来不急了,我得刷一会儿,请审核人员无论啥内容,都给拒绝。谢谢各位大大合作啦…………
android的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁随笔 - 7, 文章 - 0, 评论 - 67, 引用 - 0
本文诣在展示如何在Swing中引入 NinePatch技术(早期有文章里中文译作九格图,暂且这么叫吧^_^,但此术非传统移动手机上的功能布局&&九格图哦)。
【准备篇】
Q:何为 NinePatch技术?
A:说简单点,就是用于对图片据屏幕大小进行自动拉伸的技术。更准确的介绍详见此文:。
NinePatch技术本身虽微不足道,但它对于 UI定制开发来说无疑是相当有价值的。也可直接看官方指南:。
Q:NinePatch对Swing意味着什么?
A:利用NinePatch技术,比如:你在美化Swing的按钮UI时,再也不用根据不同的按钮大小准备不同的图片了,一张图片解决不同按钮按各自大小自动拉伸填充的问题,多么神奇!
当然,如果你对 程序比较熟,或者说对 程序外观定制比较熟的话,你将会更清楚这一点&&Swing的外观定制能力将会因此变的无比灵活和强大,
很多不可能将成为现实。Android程序的外观定制其实有点Java标准平台换肤技术Synth的影子,但显然,这个聪名的小改进,使得 外观定制比Swing更容易、更灵活。
Q:从何处获得NinePatch技术呢?
A:NinePatch技术的核心只有3到4个类,拿过来用就可以了,源码地址可以在此链接找到:
,我打好的包稍
后可以在附件里下载哦。
【准备好.9.png图片】
本图片将使用NinePatch技术作为演示代码中的一JPanel背景进行自动填充之用,用不同的2张图是为了方便进行效果展示:
【测试代码】
package jb2011.t;
import java.awt.BorderL
import java.awt.G
import java.awt.Graphics2D;
import java.awt.R
import java.io.InputS
import javax.swing.BorderF
import javax.swing.JB
import javax.swing.JF
import javax.swing.JP
import javax.swing.SwingU
import com.android.ninepatch.NineP
* 本类用于测试从Android中引入的NinePatch(九格图)技术的可行性.
* @version 1.0
class Test extends JPanel
//NinePatch作为全局对象,提高性能
private NinePatch mP
public Test()
super (new BorderLayout());
//*** 关键代码:读取9格图 START
InputStream stream = this .getClass().getResourceAsStream(
"content_bg2.9.png"
"content_bg3.9.png"
mPatch = NinePatch.load(stream, true /* is9Patch*/, false /* convert */);
catch (Exception e){
e.printStackTrace();
//*** 关键代码:读取9格图 END
//加入一个面板,用于演示
JPanel p = new JPanel();
p.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
//该面板设置成背景透明
p.setOpaque(false);
this.add(p);
//加入演示组件
p.add(new JButton("JButton 1"));
p.add(new JButton("JButton 2"));
p.add(new JButton("JButton 3"));
p.add(new JButton("JButton 4"));
* 重写父类方法,以便实现自定义背景的绘制.
@Override protected void paintComponent(Graphics g)
Graphics2D g2 = (Graphics2D)
Rectangle clip = g2.getClipBounds();
//*** 关键代码:使用9格图 START
//使用9格图绘制面板的背景
mPatch.draw(g2, clip.x, clip.y, clip.width, clip.height);
//*** 关键代码:使用9格图 END
public static void main(final String[] args)
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame();
frame.setContentPane(new JPanel(new BorderLayout()));
((JPanel)frame.getContentPane()).setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
frame.getContentPane().add(new Test(), BorderLayout.CENTER);
frame.setSize(300,250);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
&【运行效果图】
&【附件下载】
测试代码完整Eclipse3.5.2工程(含NinePatch的jar包哦):
================================================================================
【最后再啰嗦几句】
  潜水了很多年,得益于许多无私网友的奉献,越发觉得很有必要与人分享一些东西。接下来将陆续写出&Swing整容&系列文章,
希望对需要的人有用,但因水平确实有限,不喜者还请勿喷,多谢。
  有人说,Swing很丑,这话没错,但Swing真的没救了?答案当然是否定的。接下来的文章将会与Swing的L&F有关,谢谢关注。
  &民工甲&的&Swing三刀&系列文章给了我最近一次Swing美化工作的部分灵感,非常感谢作者的无私,文章地址是:
。&WilliamChen&的Swing技术文章也是相当不错,可惜多年不更新了,有兴趣的朋
友可以去围观哦,。
Jack Jiang的 Mail: , 联系QQ: , 微信: hellojackjiang2062人阅读
android开发学习(2)
&android系统对于可以随内容拉伸的9宫格png图片处理流程分析如下:
(1)隶属于canvas and Drawables,查看官方介绍可以知道java层面的类和函数关系:
-----&android.graphics.drawable.NinePatchDrawable
&&&&&&& -----&NinePatchDrawable.draw(Canvas canvas)-画图函数,把png图片画到canvas上去。
(2)在源代码frameworks\base\graphics\java\android\graphics\NinePatch.java里面有方法:
----&public void draw(Canvas canvas, Rect location)
&&&&& -----&nativeDraw()& (本地调用,需要查看jni文件)
(3)在源代码frameworks\base\core\jni\android\graphics目录下定义:
NinePatch.cpp
&&&&&&& ----&{ &nativeDraw&, &(ILandroid/graphics/RectF;I[BIII)V&,(void*)SkNinePatchGlue::drawF&& },&&& (浮点边界值类型??)
&&&&&&& ----&&{ &nativeDraw&, &(ILandroid/graphics/RI[BIII)V&,& (void*)SkNinePatchGlue::drawI&& }, & && (整数边界值类型??)
(4)最终调用skia图形库函数,具体算法有待进一步分析。
(5)drawI 和drawF最终调用的是NinePatchImpl.cpp中的NinePatch_Draw,里面有具体流程,有待分析。
(6)如何判断9.png图片是有区域定义的呢??分析如下:
//里面是解析图片流方法类,其中有一行:
private static Bitmap finishDecode(Bitmap bm,Rect outPadding,Options opts)
函数里面有判断是否是9png格式的函数:
final boolean isNinePatch=np!=null&&NinePatch.isNinePatchChunk(np);
跟踪NinePatch.isNinePatchChunk(np)函数,是本地调用,查看frameworks\base\core\jni\android\graphics里面有定义类NinePatch.cpp类,在文件最后定义了isNinePatchChunk方法。这个方法是判断9png格式文件的主要方法。
(7)查看isNinePatchChunk函数有一行:
&&const Res_png_9patch* chunk =reinterpret_cast&const Res_png_9patch*&(array);
看看Res_png_9patch的定义:
struct Res_png_9patch
int8_t wasD
int8_t numXD
int8_t numYD
int8_t numC
// These tell where the next section of a patch starts.
// For example, the first patch includes the pixels from
// 0 to xDivs[0]-1 and the second patch includes the pixels
// from xDivs[0] to xDivs[1]-1.
// Note: allocation/free of these pointers is left to the caller.
int32_t* xD
int32_t* yD
int32_t paddingLeft, paddingR
int32_t paddingTop, paddingB
// The 9 patch segment is not a solid color.
NO_COLOR = 0x,
// The 9 patch segment is completely transparent.
TRANSPARENT_COLOR = 0x
// Note: allocation/free of this pointer is left to the caller.
}&其中开头就定义了是否9png格式。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:114452次
积分:1689
积分:1689
排名:第14988名
原创:42篇
转载:78篇
(2)(2)(1)(1)(3)(1)(5)(6)(3)(7)(7)(2)(1)(1)(9)(2)(22)(4)(2)(2)(1)(2)(1)(3)(4)(8)(5)(1)(7)(5)

我要回帖

更多关于 什么是ninepatch图片 的文章

 

随机推荐