没有合适的资源?快使用搜索试试~ 我知道了~
Android编程实现的手写板和涂鸦功能
5星 · 超过95%的资源 6 下载量 98 浏览量
2020-08-28
06:33:44
上传
评论
收藏 79KB PDF 举报
温馨提示
试读
5页
主要介绍了Android编程实现的手写板和涂鸦功能,涉及Android界面布局及图形绘制功能相关实现技巧,需要的朋友可以参考下
资源推荐
资源详情
资源评论
Android编程实现的手写板和涂鸦功能编程实现的手写板和涂鸦功能
主要介绍了Android编程实现的手写板和涂鸦功能,涉及Android界面布局及图形绘制功能相关实现技巧,需要的朋
友可以参考下
本文实例讲述了Android编程实现的手写板和涂鸦功能。分享给大家供大家参考,具体如下:
下面仿一个Android手写板和涂鸦的功能,直接上代码:
write_pad.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:greendroid="http://schemas.android.com/apk/res/com.cyrilmottier.android.gdcatalog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/tablet_view"
android:layout_width="fill_parent"
android:layout_height="300dp" >
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/bottom_bar"
android:paddingTop="4dp" >
<Button
android:id="@+id/write_pad_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="确定" />
<Button
android:id="@+id/write_pad_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="清除" />
<Button
android:id="@+id/write_pad_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="取消" />
</LinearLayout>
</LinearLayout>
这个是手写板的主要布局文件,能够手写的部分是一个FrameLayout。下面有确定、清除和取消按钮,用来保存和擦除签名。
主要代码逻辑如下:主要代码逻辑如下:
MainActivity.java
package com.jackie.handwriting;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
private ImageView mIVSign;
private TextView mTVSign;
private Bitmap mSignBitmap;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mIVSign = (ImageView) findViewById(R.id.iv_sign);
mTVSign = (TextView) findViewById(R.id.tv_sign);
资源评论
- SeaNico2023-07-25这个文件介绍了一个非常实用的Android编程实现的手写板和涂鸦功能,让用户可以随时随地记录灵感和创意。
- 村上树树8252023-07-25文件详细介绍了实现手写板和涂鸦功能的关键代码,非常适合那些希望自己动手实践的人参考学习。
- ShepherdYoung2023-07-25在这个文件中,作者重点强调了用户界面的美观和用户体验的优化,使得手写板和涂鸦功能更加吸引人。
- ai2023-07-25经过测试,这个文件中提供的手写板和涂鸦功能非常稳定,对于Android开发初学者来说也很友好,操作简单易上手。
- 乖巧是我姓名2023-07-25通过阅读这个文件,我对如何在Android应用程序中实现手写板和涂鸦功能有了更深入的了解,非常感谢作者的分享。
weixin_38673921
- 粉丝: 8
- 资源: 969
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功