当前位置:网站首页>用控件当画笔获得bitmap代码记录
用控件当画笔获得bitmap代码记录
2022-08-01 04:59:00 【痕迹丶】
int width = 1000;
int height = 1000;
TextView textView = new TextView(context);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
textView.setText(“123”);
textView.setBackgroundColor(Color.YELLOW);
textView.setGravity(Gravity.CENTER);
textView.layout(0, 0, width, height);
textView.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY));
textView.draw(canvas);
边栏推荐
猜你喜欢
C# | 使用Json序列化对象时忽略只读的属性
Logitech Mouse Experience Record
高数 | 【重积分】线面积分880例题
pytorch、tensorflow对比学习—计算图和微分机制
【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
pytorch、tensorflow对比学习—张量
MySQL-数据定义语言-DDLdatebase define language
力扣(LeetCode)212. 单词搜索 II(2022.07.31)
Power button (LeetCode) 212. The word search II (2022.07.31)
Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记
随机推荐
状态压缩dp
PMP 相关方管理必背总结
万字逐行解析与实现Transformer,并进行德译英实战(二)
文件的异步读写
【愚公系列】2022年07月 .NET架构班 085-微服务专题 Abp vNext微服务网关
PAT乙级 1001 害死人不偿命的(3n+1)猜想
Dry goods!How to Construct SRv6-TE Performance Test Environment Using Instrumentation
程序员代码面试指南 CD15 生成窗口最大值数组
基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
Logitech Mouse Experience Record
Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
Power button (LeetCode) 212. The word search II (2022.07.31)
pytroch、tensorflow对比学习—功能组件(数据管道、回调函数、特征列处理)
typescript24 - type inference
Excel record of integer programming optimization model to solve the problem
MySQL-数据定义语言-DDLdatebase define language
干货!如何使用仪表构造SRv6-TE性能测试环境
The Flow Of Percona Toolkit pt-table-checksum
(2022牛客多校四)K-NIO‘s Sword(思维)