draw9patch工具使用教程
来源:互联网 发布:苏亚星网络备课系统 编辑:程序博客网 时间:2024/05/17 05:02
- package
com.himi; - import
android.content.Context; - import
android.graphics.Bitmap; - import
android.graphics.BitmapFactory; - import
android.graphics.Canvas; - import
android.graphics.Color; - import
android.graphics.NinePatch; - import
android.graphics.Paint; - import
android.graphics.RectF; - import
android.util.Log; - import
android.view.SurfaceHolder; - import
android.view.SurfaceView; - import
android.view.SurfaceHolder.Callback; - public
class MySurfaceView extendsSurfaceView implementsCallback, Runnable { -
Thread newth = Thread( this); -
SurfaceHolder sfh; -
Canvas canvas; -
Paint paint; -
Bitmap bmp_old; -
Bitmap bmp_9path; -
NinePatch np; -
MySurfaceView(Context context) { -
-
-
bmp_old = BitmapFactory.decodeResource(getResources(), R.drawable.himi_old); -
bmp_9path = BitmapFactory.decodeResource(getResources(), R.drawable.himi_9path); -
np = NinePatch(bmp_9path, null);bmp_9path.getNinePatchChunk(), -
-
-
我们直接用“.9.png”图片自身的数据调用getNinePatchChunk()即可 -
-
sfh = -
sfh.addCallback( -
paint = Paint(); -
paint.setAntiAlias( -
setFocusable( -
} -
void surfaceCreated(SurfaceHolder holder) { -
Log.v( "surfaceCreated"); -
th.start(); -
} -
-
void draw() { -
canvas = sfh.lockCanvas(); -
canvas.drawColor(Color.BLACK); -
RectF rectf_old_two = RectF( 0,50, bmp_old.getWidth() 2,* 120 + 2);//备注1bmp_old.getHeight() * -
RectF rectf_old_third = RectF( 0,120 + 2,bmp_old.getHeight() * bmp_old.getWidth() 3,* -
+ 2bmp_old.getHeight() * + 3);bmp_old.getHeight() * -
--------下面是对正常png绘画方法----------- -
canvas.drawBitmap(bmp_old, 0, paint); -
canvas.drawBitmap(bmp_old, rectf_old_two, paint); -
canvas.drawBitmap(bmp_old, rectf_old_third, paint); -
RectF rectf_9path_two = RectF( 250,50, 250 + 2,bmp_9path.getWidth() * 90 + 2);bmp_9path.getHeight() * -
RectF rectf_9path_third = RectF( 250,120 + 2,bmp_9path.getHeight() * 250 + 3,bmp_9path.getWidth() * -
+ 2bmp_9path.getHeight() * -
+ bmp_9path.getHeight() * -
canvas.drawBitmap(bmp_9path, 0, paint); -
--------下面是".9.png"图像的绘画方法----------- -
np.draw(canvas, rectf_9path_two); -
np.draw(canvas, rectf_9path_third); -
sfh.unlockCanvasAndPost(canvas); -
} -
void run() { -
TODO Auto-generated method stub -
( true){ -
draw(); -
{ -
Thread.sleep( -
} (Exception ex) { -
} -
} -
} -
void surfaceChanged(SurfaceHolder intholder, format, intwidth, intheight) { -
Log.v( "surfaceChanged"); -
} -
void surfaceDestroyed(SurfaceHolder holder) { -
Log.v( "surfaceDestroyed"); -
} - }
http://blog.sina.com.cn/s/blog_a1c7921b0101lx1f.html
- draw9patch工具使用教程
- android draw9patch工具使用
- draw9patch工具使用
- draw9patch使用
- android系统工具之 draw9patch超详细教程
- Android SDK自带draw9patch工具详细教程
- .9图片的制作(draw9patch.bat工具的使用)
- .9图片的制作(draw9patch.bat工具的使用)
- .9图片的制作(draw9patch.bat工具的使用)
- Android工具draw9patch使用点.9.png图片制作
- draw9patch超详细教程
- draw9patch超详细教程
- draw9patch超详细教程
- draw9patch超详细教程
- android,draw9patch的使用
- draw9patch使用原则
- draw9patch不能使用解决
- Ubutun Linux 使用draw9patch
- ArcGIS教程:地理处理服务示例(选择数据)(三)
- 网上找的用shell写的俄罗斯方块,膜拜一下!!
- lightoj 1025-The Specials Menu 区间DP
- 【Web】TCP/IP端口
- Extjs获取后台json留着剩的忘了
- draw9patch工具使用教程
- 【js】paginnation.js 实现 页面分页
- FreeMarker标签与使用
- c语言 enum 定义里面,末尾的逗号
- 编译原理概要
- DBMS_NETWORK_ACL_ADMIN 包的使用
- android 短信拦截器 代码
- eclipse创建maven依赖的web3.0项目
- 实用文章收藏