介绍
这期内容当中小编将会给大家带来有关Android开发中项目实现一个画板功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
<>强效果图如下强>
<强> XML布局代码强>
& lt; RelativeLayout xmlns: Android=癶ttp://schemas.android.com/apk/res/android" xmlns:工具=癶ttp://schemas.android.com/tools" android: layout_width=癿atch_parent" android: layout_height=癿atch_parent" android: paddingBottom=癅dimen/activity_vertical_margin" android: paddingLeft=癅dimen/activity_horizontal_margin" android: paddingRight=癅dimen/activity_horizontal_margin" android: paddingTop=癅dimen/activity_vertical_margin" 工具:上下文=癱om.tomes.paint.MainActivity"比; & lt; ImageView android: id=癅 id/iv_drawingBoard" android: layout_width=皐rap_content" android: layout_height=皐rap_content" android: src=https://www.yisu.com/zixun/" @drawable/bg "/>
<强> Java代码强>
公共空init () { 位图的位图=BitmapFactory.decodeResource (getresource (), R.drawable.bg); copyBitmap=Bitmap.createBitmap (bitmap.getWidth (), bitmap.getHeight (), bitmap.getConfig ()); 涂=new (); 帆布=新画布(copyBitmap); 矩阵矩阵=new矩阵(); 画布。drawBitmap(位图、矩阵、油漆); imageView=(imageView) findViewById (R.id.iv_drawingBoard); imageView.setImageBitmap (copyBitmap); imageView.setOnTouchListener (new>上述就是小编为大家分享的Android开发中项目实现一个画板功能了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。Android开发中项目实现一个画板功能