目录
一、测试环境说明
电脑环境
Windows 11
编写语言
JAVA
开发软件
Android Studio (2020)
开发软件只要大于等于测试版本即可(近几年官网直接下载也可以),若是版本低于测试版本请自行测试。项目需要根据你的软件自行适配
二、项目简介
该项目简介来自网络,具体内容需要自行测试
这个手绘板App使用Android Studio开发,主要实现了用户触摸屏幕绘制图案的功能。
程序通过监听MotionEvent事件识别用户手势(按下、移动、抬起),使用Path类记录绘制轨迹,并在Canvas上实时绘制。画笔颜色通过HSV色彩模型动态调整,用户可以通过SeekBar滑动条选择不同颜色。
应用采用双层布局设计,顶部是操作栏(包含设置和保存按钮),下方是绘图区域。图片保存功能使用MediaStore API,将绘制的Bitmap以PNG格式保存到系统相册。
代码中处理了多指触控的情况,为每个触摸点维护独立的Path对象。同时实现了权限请求逻辑,确保在Android 6.0及以上版本能正常保存文件。
该应用还包含简单的状态保存功能,使用SharedPreferences存储用户最后选择的颜色值,提升用户体验。
三、项目演示
网络资源模板--基于Android studio 手绘板App
四、部设计详情(部分)
首页
1. 页面的结构
该页面采用垂直线性布局,整体分为上下两部分。顶部是一个白色背景的水平布局,包含两个功能按钮:设置按钮和保存按钮。
底部是一个占满剩余空间的ImageView,用于显示绘图内容。布局设计简洁明了,顶部操作栏固定高度,底部绘图区域自适应屏幕剩余空间,实现了功能分区明确、操作便捷的用户界面。
2. 使用到的技术
该应用使用了Android的基础绘图技术,通过Bitmap、Canvas和Paint实现手绘功能。
采用触摸事件处理多指绘制,支持多点触控。颜色选择通过PopupWindow和SeekBar实现交互式调色。图片保存功能利用MediaStore API,适配了Android不同版本的文件存储方案。
还涉及权限管理、SharedPreferences数据存储等核心技术点。
3. 页面详细介绍
这是一个简易绘图应用的主界面,用户可以在白色画布上进行自由绘制。
顶部设置按钮可弹出调色板,通过滑动条选择不同颜色;保存按钮将作品以PNG格式存储到系统相册。绘图区域支持多点触控,能同时响应多个手指的绘制操作。
界面设计以功能实用为主,操作流程直观,适合快速绘图和创意表达,整体交互体验流畅自然。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical"
android:padding="0dp"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#fff"
android:gravity="bottom"
android:orientation="horizontal"
android:padding="0dp">
<ImageButton
android:id="@+id/settingsButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="0dp"
android:background="@color/white"
android:scaleType="fitCenter"
android:src="@drawable/brush" />
<ImageButton
android:id="@+id/btn_resume"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="0dp"
android:background="@color/white"
android:scaleType="fitCenter"
android:src="@drawable/save" />
</LinearLayout>
<ImageView
android:id="@+id/iv1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
</LinearLayout>
五、项目源码
👇👇👇👇👇快捷方式👇👇👇👇👇